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?