开发者

mysql query on dob

开发者 https://www.devze.com 2023-01-19 06:21 出处:网络
If DOB is given in this porder- 1853-03-12 , then how do we find the youngest person from table bases on this type of data. If the year is same but month is diff开发者_开发问答erent for 2 persons.

If DOB is given in this porder- 1853-03-12 , then how do we find the youngest person from table bases on this type of data. If the year is same but month is diff开发者_开发问答erent for 2 persons.

I tried MIN(dob)- it gives me the oldest person and When I tried MAX, it gives me nothing.


It's weird, however you can use ORDER BY dob DESC LIMIT 1

What's your full query ?

EDIT : resolved by email ^^


MAX should usualy do the job. maybe you have any datasets with NULL-value in that column? one thing you could try is to ORDER BY dob DESC and LIMIT 1.

0

精彩评论

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