我需要根据创建时间获得最大优先级值。我的查询在这里,
select
t.id, ocf1.Content Priority, ocf1.created
from
Tickets t inner Join ObjectCustomFieldValues ocf1
on ocf1.ObjectId=t.id
where
ocf1.CustomField=301
and t.queue in (27,50,49,52)
and t.status not in ('rejected','deleted')
and t.created between subdate(now(),interval 1500 minute) and now();
id Priority created
-------------------------------
27344 P4 28/01/13 09:17
27344 Incident 28/01/13 09:18
27345 P4 28/01/13 09:22
27346 P4 28/01/13 09:25
27353 P4 28/01/13 10:08
27353 Incident 28/01/13 10:09
27360 P4 28/01/13 10:38
27360 Incident 28/01/13 10:39
27365 P3 28/01/13 11:52
27376 P4 28/01/13 14:49
示例:这里我需要Incident
id的最大优先级值27344
。与其他 ID 相同。