使用类似命令和逻辑运算符的sqlite

发布于 2025-02-13 10:21:02 字数 573 浏览 1 评论 0原文

我试图根据具有逻辑或逻辑的类似命令来排除一些记录。他们单独工作,但共同工作。

 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋叶绚丽 2025-02-20 10:21:02

我犯的错误是使用或操作员应该使用,然后使用。

Mistake I made was to use the OR operator, Should have used AND then it works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文