Home » SQL & PL/SQL » SQL & PL/SQL » SQL select using Date comparisons
SQL select using Date comparisons [message #18844] Mon, 18 February 2002 10:51 Go to next message
Dave Rolfe
Messages: 4
Registered: February 2002
Junior Member
Using the Table Offer

OFFERCODE | OFFER_DATE | PRICE | NUM_SOLD
-----------------------------------------
E21 01/02/2002 £3.99 4
E22 01/06/2001 £9.99 14

I am trying to

SELECT offercode
WHERE offer_date *is within 6 months of todays date*

I know i need to use SYSDATE but am unsure as to how to specify 6 months prior to todays date.

Many Thanks
Dave Rolfe

(if any replies could be mailed to me i will be immensley greatful!)
Re: SQL select using Date comparisons [message #18845 is a reply to message #18844] Mon, 18 February 2002 11:14 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
SELECT offercode
WHERE offer_date between add_months(sysdate,-6) and sysdate

or

SELECT offercode
WHERE offer_date>=add_months(sysdate,-6) and offer_date<=sysdate
Previous Topic: How to sum the fields in the oracle?????
Next Topic: help installing SQLPlus Help
Goto Forum:
  


Current Time: Wed Apr 24 06:55:16 CDT 2024