postgresqlHow can I retrieve data from PostgreSQL for yesterday's date?
The following example code block can be used to retrieve data from PostgreSQL for yesterday's date:
SELECT *
FROM table_name
WHERE date_column = CURRENT_DATE - INTERVAL '1 day';
This statement will select all data from the specified table with a date value equal to yesterday's date.
The parts of the code are:
SELECT *- This selects all columns from the specified table.FROM table_name- This specifies the table from which the data should be retrieved.WHERE date_column = CURRENT_DATE - INTERVAL '1 day'- This specifies the condition for selecting data from the table where the date column is equal to yesterday's date.
Helpful links
More of Postgresql
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL with Zabbix?
- How do I use PostgreSQL's XMIN and XMAX features?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I use Postgresql's Write Ahead Logging (WAL) feature?
- How do I use the PostgreSQL NVL function?
- How do I create a view in PostgreSQL?
- How do I update a record in PostgreSQL?
- How do I use PostgreSQL's ON CONFLICT DO NOTHING clause?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
See more codes...