
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
Hi Frank, Try declaring the variable as data type INTERVAL eg: declare :age interval year; begin set :age =cast(50 as interval year); end; select distinct last_name from employees WHERE CAST(BIRTHDAY AS DATE ANSI) >= (CAST(CURRENT_TIMESTAMP AS DATE ANSI)- :age); Regards Richard Maher Frank Hung <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dear all, > I have wrriten an sqlmod, show part of them as below: > > > SELECT DISTINCT PROCESS_FLOW_ID FROM FCA_LOT > WHERE CAST(TIME_STAMP AS DATE ANSI)>= > CAST(CURRENT_TIMESTAMP AS DATE ANSI)- INTERVAL'60' DAY) > > According to bove codes, i want to get data 60 days ago. But i hope this > time interval is variable but not fix. So i try to edit bellow codes: > > ...CAST(CURRENT_TIMESTAMP AS DATE ANSI)- INTERVAL :vat_day DAY) > However, above codes are syntax wrong. How should i do or any sql statement > to reach my object ?
| <-- __Chronological__ --> | <-- __Thread__ --> |