Cariamole Cariamole - 1 year ago 87
SQL Question

Select people from database based on their age

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

In my table

, I have a column login and a column birth.

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

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

Do you have an idea why that doesn't work?

Answer Source

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

(JulianDay('now') - JulianDay(birth)) / 365
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download