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