May 9, 2003 #1 ShortyA MIS Feb 20, 2002 363 CH Hi there, I am trying to write a script that extracts data where a date field contains a value that is from the last full month. Does anyone have any guidance on the syntax ? Thanks very much, Alec
Hi there, I am trying to write a script that extracts data where a date field contains a value that is from the last full month. Does anyone have any guidance on the syntax ? Thanks very much, Alec
May 9, 2003 #2 ARWinner Programmer Feb 18, 2003 12 US Alec, How about: Select * from mytable where month(mydate) = month(current date - 1 MONTH) HTH Andy Upvote 0 Downvote
May 9, 2003 #3 sathyarams IS-IT--Management Jan 2, 2002 290 GB Is this what you are looking for : values(current date - day(current date) days +1 day - 1 month) 1 ---------- 04/01/2003 1 record(s) selected. values (current date - day(current date) days ) 1 ---------- 04/30/2003 1 record(s) selected. More DB2 questions answered at http://www.dbforums.com/f8 Upvote 0 Downvote
Is this what you are looking for : values(current date - day(current date) days +1 day - 1 month) 1 ---------- 04/01/2003 1 record(s) selected. values (current date - day(current date) days ) 1 ---------- 04/30/2003 1 record(s) selected. More DB2 questions answered at http://www.dbforums.com/f8
May 9, 2003 Thread starter #4 ShortyA MIS Feb 20, 2002 363 CH Thanks for your help. I used the suggestion from ARWinner and it was exactly what I needed. Alec Upvote 0 Downvote