Cariamole Cariamole - 6 months ago 12
SQL Question

Select people from database in function of thier age

I'm actually working on a database and I need to obtain a list of people who have between a minimum age and a maximum age.

In my table person, i got a column "login" an a column "birth".

I have already tried this method (only for minimum age), but we have no result :

SELECT login FROM person WHERE ((JulianDay('now')) - (JulianDay(birth))/365) > 5


Do you have an idea of what doesn't work.
Thank you.

Answer

Currently you do n - m / 365 and division is done before subtraction. :-)

(JulianDay('now') - JulianDay(birth)) / 365
Comments