If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Question for pat phelan

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-17-09, 17:14
geo123 geo123 is offline
Registered User
 
Join Date: Jun 2009
Posts: 6
Question for pat phelan

I'm using KBS SQL -a Microsoft product. I'm looking to retrieve data from previous three months. For example April 1, to June 30. May 1 to July 31. Although the following code that you gave me does work correctly, I'm looking for data to start from the first of the month i.e. if the three months are May 1 thru July 31, the data should start with May 1. The data should be in chronological order. The following code is SET :XEOPM = TODAY - SQL_FN_DAYOFMONTH(TODAY)
SET :XBOPM = TODAY - SQL_FN_DAYOFMONTH(TODAY)
SET :XBOPM = :XBOPM - SQL_FN_DAYOFMONTH(:XBOPM)
SET :XBOPM = :XBOPM - SQL_FN_DAYOFMONTH(:XBOPM)
SET :XBOPM = :XBOPM - SQL_FN_DAYOFMONTH(:XBOPM) + 1

However the data I get back gives me data that is not in chronological order. It gives me the first data with a admisson date of May 11,I'm looking for data that has May 1 to start with.

Thanks
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On