SQLITE SELECT 一个日期整数列,如果该日期的所有记录在另一个参数中均为 NULL
我可能以错误的方式处理这个问题...
我有一个表,其中日期为 INTEGER
,格式为 yyyymmdd
- 名为 DateInteger
我有另一个字段Method
,默认情况下为NULL
。该字段由各种查询更新。 我想生成一份报告,说明所有 Method
字段均为 NULL
的日子(按 DateInteger
分组/排序)。
`SELECT DateInteger,COUNT(*) FROM Table WHERE Method IS NOT NULL GROUP BY DateInteger HAVING Count(*)=0 ORDER BY DateInteger ASC;` doesn't give any results, as the days which have only `NULL` values seem to be missed out...
我如何使查询包含/查看这些天?
TIA
I'm probably approaching this the wrong way...
I have a table with the Date as an INTEGER
in format yyyymmdd
- named DateInteger
I have another field Method
which is NULL
by default. This field is updated by various queries.
I'd like to produce a report that illustrates the days where ALL the Method
fields are NULL
(Grouping/Ordering by DateInteger
).
`SELECT DateInteger,COUNT(*) FROM Table WHERE Method IS NOT NULL GROUP BY DateInteger HAVING Count(*)=0 ORDER BY DateInteger ASC;` doesn't give any results, as the days which have only `NULL` values seem to be missed out...
How do I make the query include / look at these days ?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想生成一份报告,说明所有方法字段均为 NULL 的日期(按 DateInteger 分组/排序)。
这将返回一组不同的日期字段值,其中方法列值为 < em>not null:
如果我理解您的意思,上面的这些日期字段值是您不想要的值:您需要给定日期的每一行中的所有方法值都为 null 。因此,您想要的日期字段值不能位于上面的集合中。
编辑:你也可以尝试这个:
I'd like to produce a report that illustrates the days where ALL the Method fields are NULL (Grouping/Ordering by DateInteger).
This will return a distinct set of datefield values where the method column value is not null:
If I understand you, these datefield values above are the ones you do not want: you need all of the method values in every row with a given date to be null. Thus, the datefield values you do want cannot be in the set above.
EDIT: you might also try this: