How to treat data from a Date lookup in the where clause in Postgres?

0

I have a screen where you have a list of payment titles for a company, and I need to do a dynamic search from the issue date of the title. The idea is that when the user enters the date in a search field, this data will be passed dynamically via AJAX to a file where there will be the SQL query. My question, how am I going to build my WHERE ?. Ex: WHERE data_emissao ILIKE '%2015-01-01%'
Can anyone help me?

    
asked by anonymous 23.10.2015 / 15:05

1 answer

2

You can compare a piece of the date with the extract , the first argument is the desired type and the second is the field name.

SELECT ... WHERE data_emissao = '2015-10-23'

SELECT ... WHERE extract(year from data_emissao) = 2015
    
23.10.2015 / 15:34