开发者

GROUPING DATEs in sql

开发者 https://www.devze.com 2023-01-04 12:20 出处:网络
i have a table in which there are ids and resigning dates. a singlle id have more than one resigning date.

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

精彩评论

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