views:

65

answers:

1

Hi,

I am writing a query on Mysql . I have to find the youngest customer and in my database , I have 2 persons with same dob. I am doing it in a way that first it checks all the conditions and then order by dob desc, limit 1. It gives me only 1 result. If I set the limit 2, I get the second person but setting limit according to database is not right. I have to make it independent of LIMIT.

+2  A: 

So you want ALL the youngest customers returned? How about:

SELECT * FROM customers WHERE dob = (SELECT MAX(dob) FROM customers)

?

Mikey Cee
Is the obvious error on purpose or not?