使用类似命令和逻辑运算符的sqlite
我试图根据具有逻辑或逻辑的类似命令来排除一些记录。他们单独工作,但共同工作。
Select CustomerName
,Type
,sum(Quantity) as Total
,TimeDate
,date(TimeDate) as JustDate
,DATE(date(TimeDate),'start of month') as BeginMonth
, DATE(date(date(TimeDate),'start of month'),'+1 month') as BeginNextMonth
,DATE(date(TimeDate),'start of month','+1 month','-1 day') as EndOfMonth
,DATE(date(TimeDate),'start of month','-1 day') as EndOfLastMonth
from history
where (Type not like '%LPG%') or (Type not like '%Hyster%')
group by type,CustomerName
I am trying to exclude some records according to a LIKE command with a Logical OR. Individually they work but together they do not.
Select CustomerName
,Type
,sum(Quantity) as Total
,TimeDate
,date(TimeDate) as JustDate
,DATE(date(TimeDate),'start of month') as BeginMonth
, DATE(date(date(TimeDate),'start of month'),'+1 month') as BeginNextMonth
,DATE(date(TimeDate),'start of month','+1 month','-1 day') as EndOfMonth
,DATE(date(TimeDate),'start of month','-1 day') as EndOfLastMonth
from history
where (Type not like '%LPG%') or (Type not like '%Hyster%')
group by type,CustomerName
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我犯的错误是使用或操作员应该使用,然后使用。
Mistake I made was to use the OR operator, Should have used AND then it works.