date_part Postgresql

Hi
select date_part(‘days’, now() - fdate) as days from payinfo where socionum=‘12’ and days <300

i need to compare two dates and compare to days <300 but on postgresql no works

any idea
thanks

select date_part(‘days’, now() - fdate) as days from payinfo where socionum = ‘12’ and Cast(date_part(‘days’, now() - fdate) as integer) < 300

Thanks Peter

Hi

Cast It is not necessary

select date_part(‘days’, now() - fdate) as days from payinfo where socionum=‘12’ and date_part(‘days’, now() - fdate) < 300

Mauricio

Thanks Mauricio. Old habits carried over :slight_smile: