我正在尝试更改汇总安装中的日期搜索行为,但 SQL 不是我的强项。这是现有的查询:
select _issue.id,_issue._activity,(_issue._activity is not NULL),
_priority3._order,(_priority3._order is not NULL) from _issue
LEFT OUTER JOIN _priority as _priority3
on _issue._priority=_priority3.id
where _issue._activity >= '2015-01-16 08:00:00.000' and
_issue._activity <= '2015-01-17 07:59:59.000' and
_issue.__retired__=0
order by (_priority3._order is not NULL),_priority3._order,
(_issue._activity is not NULL),_issue._activity,_issue.id
以下是包含有趣字段的表格:
table: _issue
fields: id (integer)
_activity (timestamp)
_priority (integer)
table: _priority (alias priority3)
fields: id (integer)
order (real)
我需要使用的表:
table: issue_messages
fields: linkid (integer, id of message)
nodeid (integer, id of issue)
table: _msg
fields: id (integer)
_activity (timestamp)
我想要的是有任何活动的问题列表,这意味着检查消息活动日期,而不是问题活动日期(仅反映最后一个活动)。