Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What SQL query I need for this?

843854Feb 12 2005 — edited Feb 14 2005
I need to execute a SQL query but I don't know how.

To illustrate it, please take a look at some example data:
    ARTICLEID SOLDON     
    1         2005-12-31 
    1         2005-11-31 
    1         2005-10-31 
    1         2005-09-31 
    1         2005-08-31 
    1         2005-07-31 
    1         2005-06-31 
    1         2005-05-31 
    1         2005-04-31 
    1         2005-03-31 
    1         2005-02-31 
    1         2005-01-31 
    1         2004-12-31 
    1         2004-11-31 
    2         2005-12-31 
    2         2005-11-31 
    2         2005-10-31 
    2         2005-09-31 
This is a piece of the sales data for the articles (sales history).

Lets assume that today is the date 2005-12-31.

Two requirements for the query:
1. Get the sales data for the last 12 months.
2. Get only the sales data for articles where there is sales data since at least 6 months.

The result in my example should look like this:
    ARTICLEID SOLDON     
    1         2005-12-31 
    1         2005-11-31 
    1         2005-10-31 
    1         2005-09-31 
    1         2005-08-31 
    1         2005-07-31 
    1         2005-06-31 
    1         2005-05-31 
    1         2005-04-31 
    1         2005-03-31 
    1         2005-02-31 
    1         2005-01-31 
What is the SQL which I need to accomplish this query?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2005
Added on Feb 12 2005
21 comments
110 views