sqlite select with condition on date

前端 未结 3 1032
一生所求
一生所求 2020-11-29 06:03

I have an sqlite table with Date of Birth. I would like to execute a query to select those records where the age is more than 30. I have tried the following but it doesn\'t

3条回答
  •  时光取名叫无心
    2020-11-29 06:27

    Try writing using the date format 'YYYY-MM-DD'

    select * from mytable where dob > '1980-01-01'
    

    A more programic way would be something like this:

    select * from mytable where datediff(dob, now()) > 30
    

    You'll Need to find specific syntax for sqlite.

提交回复
热议问题