开发者

GROUPING DATEs in sql

i have a table in which there are ids and resigning dates. a singlle id have more than one resigning date.

how can i display the table in 开发者_Go百科which one id have only one resigning date which is the latest ie the maximum date.

can somebody help me plzz....thanx a ton


select id, max(resignDate)
from mytable
group by id

It's not clear from the question on whether you want to ensure there is only one row in the table for a given ID. If you require that there's only one entry for the given ID, then the statement should have, at the end: having count(id) = 1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜