SQL Language (MOSC)

MOSC Banner

What is Oracle SQL for - Is Less than or equal to 2 Days In the past?

edited Jan 4, 2018 4:19AM in SQL Language (MOSC) 6 comments

I want to return the email addresses whose LASTPURCHASEDATE  'Is Is Less than or equal to 2 Days In the past?'

Is there an equivalent in SQL for the statement  'Is Less than or equal to 2 Days In the past'

I have joined three tables together; CONTACTS_LIST, Profile_Purchase_Data (which includes the field LASTPURCHASEDATE) and a Purchase table (that includes BRAND and ITEMCATEGORY). See SQL below

SELECT $A$.EMAIL_ADDRESS_, $B$.LASTPURCHASEDATE, $C$.ORDERDATE, $C$.BRAND, $C$.ITEMCATEGORY FROM $A$    INNER JOIN $B$   ON $A$.RIID_ = $B$.RIID_ INNER JOIN $C$ ON $A$.EMAIL_ADDRESS_  = $C$.EMAIL_ADDRESS_  WHERE $C$.BRAND = 'UGG' OR $C$.BRAND = 'UGG AUSTRALIA' AND $C$.ITEMCATEGORY = 'Boots' AND $B$.LASTPURCHASEDATE <= (SYSDATE - 2)

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center