vb.net+sqLite 数据库 时间段查询

shelyas 2015-08-13 01:44:04
我想要查询:1.当天的数据 2.当月的数据,3当年的数据
麻烦写下查询语句

dim str as string="select * from tongji where [销售时间] = XXXXX"
我想在搞不明白这个XXXXX 应该如何写
...全文
205 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
都用同个函数,这个也是当天

select * from tongji where strftime('%Y%m%d',[销售时间])=strftime('%Y%m%d','now','localtime')  --当天
  • 打赏
  • 举报
回复
引用 2 楼 shelyas 的回复:
[quote=引用 1 楼 chb345536638 的回复:] 用strftime函数
具体该怎么用呢。。我查询了下 没有找打关于vb.net strftime函数有关的描述[/quote] 这跟VB.NET有什么关系,你该查SQLITE时间函数语法。。

select * from tongji where [销售时间]=date('now','localtime') --当天
select * from tongji where strftime('%Y%m',[销售时间])=strftime('%Y%m','now','localtime')  --当月
select * from tongji where strftime('%Y',[销售时间])=strftime('%Y','now','localtime')  --当年
shelyas 2015-08-13
  • 打赏
  • 举报
回复
引用 1 楼 chb345536638 的回复:
用strftime函数
具体该怎么用呢。。我查询了下 没有找打关于vb.net strftime函数有关的描述
  • 打赏
  • 举报
回复
用strftime函数

16,553

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧