Select data from table based on current date
Posted on 2006-03-23
I'm trying to run a sql statement is DB2 to use as part of a stored procedure but it doesn't work.
select * from table1 where created_date = date(char(current timestamp)) - 1 days
I'm getting this error:
SQL0401N The data types of the operands for the operation "="
are not compatible. SQLSTATE=42818
I need to select data based on the prior day(which I was trying to do above), last 7 days and last full month. All of the date fields in my tables are of datetime format and I only need to evaluate the date. Any suggestions???