Reputation: 87
In my where clause i want to get only the records that have today's date and the last 30 days records. so i would want 3-29-19 through 4-29-19 records but i need this a rolling date so tomorrow it would be 3-30 through 4-30-19 Basically pulling up the last 30 days worth of records.
curdate() gets me the current date in advantage sql. im thinking maybe a between clause or something.
dateadd(dd,-30,curdate()),
Upvotes: 1
Views: 1878
Reputation: 125728
ADS allows you to do straight math on dates (if you've got an actual date column in the table), so you can use
WHERE datecol between curdate() - 30 and curdate()
Upvotes: 1
Reputation: 1270463
I think it would be something like:
where datecol >= timestampadd(SQL_TSI_DAY, -30, current_date())
Upvotes: 1