All Forums Database
vijay65 17 posts Joined 10/13
25 Nov 2013
required to get the records for last 6 months

i have order_date column having date.
i wanted to add a filter such i will be getting records for only past 6 months records only.
 
do help me.
waiting for your valueable reply
thanks in advance

M.Saeed Khurram 544 posts Joined 09/12
25 Nov 2013

Hi peiter,
you can add order_date - INTERVAL '6' MONTH in the where clause.
Further you can partition this table to gain performance.
 

Khurram

vijay65 17 posts Joined 10/13
26 Nov 2013

not working sir..!!!

vijay65 17 posts Joined 10/13
26 Nov 2013

what i actully want is this "sum of expectedAmount amounts measured for wich the expectedOrderDate is in last 6  months.
the expected amount is coming from another table and order_date is coming from another table.

do reply waiting

M.Saeed Khurram 544 posts Joined 09/12
26 Nov 2013

oops! Whats the data in your order_date column?
Can you please paste 2-3 values from order_date?
 

Khurram

M.Saeed Khurram 544 posts Joined 09/12
26 Nov 2013

Yes I am getting you, but what I want to take a look at the date format in your order_date column. 
If this condition is not working then we might need to change the date_order format to subtract interval from it.
 

Khurram

M.Saeed Khurram 544 posts Joined 09/12
26 Nov 2013

If you need me to produce a working query, I would need the structure of bothe the tables and some sample data to work on.
 

Khurram

vijay65 17 posts Joined 10/13
26 Nov 2013

its is having long structure.
i will summeries it.
1 table name with opportunity with opportunity_id column,expected_amount column.
another table with name sales with opportunity_id and order_date column.

so what we want is this "sum of expectedAmount amounts measured for wich the expectedOrderDate is in last 6  months.
the expected amount is coming from another table and order_date is coming from another table.

does it make sense????

M.Saeed Khurram 544 posts Joined 09/12
26 Nov 2013

Yes, it makes sense, can you execute the following query and paste the some date values here,
Select order_date from sales;
 

Khurram

vijay65 17 posts Joined 10/13
26 Nov 2013

Order_Date
9/30/2013
9/30/2013
9/29/2013
9/27/2013
9/27/2013
9/27/2013
9/26/2013
9/26/2013
9/26/2013
9/26/2013
9/26/2013
9/26/2013
9/25/2013
9/25/2013
9/25/2013
9/25/2013
9/24/2013
9/24/2013
9/24/2013
9/24/2013
9/24/2013
9/24/2013
9/24/2013
9/23/2013
9/23/2013
9/23/2013
9/20/2013
9/20/2013
9/20/2013
9/20/2013
9/19/2013
9/19/2013
9/19/2013
9/19/2013
9/18/2013
9/18/2013
9/18/2013
9/17/2013
9/17/2013
9/17/2013
9/17/2013
9/17/2013
9/16/2013
9/16/2013
9/13/2013
9/13/2013
9/13/2013
9/13/2013
9/12/2013
9/12/2013
9/12/2013
9/12/2013
9/12/2013
9/11/2013
9/11/2013
9/11/2013
9/11/2013
9/10/2013
9/10/2013
9/10/2013
9/9/2013
9/9/2013
9/9/2013
9/9/2013
9/6/2013
9/6/2013
9/6/2013
9/5/2013
9/5/2013
9/5/2013
9/5/2013
9/5/2013
9/4/2013
9/4/2013
9/4/2013
9/3/2013
9/3/2013
9/3/2013
9/2/2013
9/2/2013
9/2/2013
9/2/2013
8/31/2013
8/30/2013
8/30/2013
8/29/2013
8/29/2013
8/29/2013
8/29/2013
8/29/2013
8/29/2013
8/28/2013
8/28/2013
8/28/2013
8/28/2013
8/28/2013
8/27/2013
8/27/2013
8/27/2013
8/27/2013
8/26/2013
8/26/2013
8/26/2013
8/23/2013
8/23/2013
8/23/2013
8/23/2013
8/23/2013
8/22/2013
8/22/2013
8/21/2013
8/21/2013
8/21/2013
8/20/2013
8/20/2013
8/19/2013
8/19/2013
8/19/2013
8/19/2013
8/16/2013
8/15/2013
8/14/2013
8/14/2013
8/14/2013
8/13/2013
8/13/2013
8/13/2013
8/13/2013
8/13/2013
8/12/2013
8/12/2013
8/12/2013
8/9/2013
8/9/2013
8/9/2013
8/8/2013
8/8/2013
8/7/2013
8/7/2013
8/6/2013
8/6/2013
8/6/2013
8/6/2013
8/6/2013
8/5/2013
8/5/2013
8/3/2013
8/2/2013
8/2/2013
8/1/2013
8/1/2013
8/1/2013
8/1/2013
7/31/2013
7/31/2013
7/31/2013
7/30/2013
7/30/2013
7/29/2013
7/29/2013
7/29/2013
7/29/2013
7/26/2013
7/26/2013
7/25/2013
7/25/2013
7/24/2013
7/24/2013
7/24/2013
7/23/2013
7/23/2013
7/23/2013
7/22/2013
7/22/2013
7/19/2013
7/19/2013
7/19/2013
7/18/2013
7/18/2013
7/18/2013
7/17/2013
7/17/2013
7/17/2013
7/16/2013
7/16/2013
7/16/2013
7/16/2013
7/15/2013
7/15/2013
7/15/2013
7/12/2013
7/12/2013
7/12/2013
7/11/2013
7/11/2013
7/10/2013
7/10/2013
7/10/2013
7/10/2013
7/9/2013
7/9/2013
7/8/2013
7/8/2013
7/8/2013
7/7/2013
7/5/2013
7/4/2013
7/4/2013
7/4/2013
7/4/2013
7/4/2013
7/3/2013
7/3/2013
7/3/2013
7/2/2013
7/2/2013
7/2/2013
7/2/2013
7/2/2013
7/1/2013
7/1/2013
7/1/2013
7/1/2013
6/28/2013
6/28/2013
6/27/2013
6/27/2013
6/26/2013
6/26/2013
6/26/2013
6/26/2013
6/25/2013
6/25/2013
6/24/2013
6/24/2013
6/24/2013
6/24/2013
6/24/2013
6/21/2013
6/21/2013
6/21/2013
6/20/2013
6/20/2013
6/20/2013
6/19/2013
6/19/2013
6/18/2013
6/18/2013
6/18/2013
6/17/2013
6/17/2013
6/17/2013
6/14/2013
6/14/2013
6/13/2013
6/13/2013
6/13/2013
6/12/2013
6/12/2013
6/12/2013
6/12/2013
6/12/2013
6/11/2013
6/11/2013
6/11/2013
6/10/2013
6/10/2013
6/10/2013
6/10/2013
6/10/2013
6/7/2013
6/7/2013
6/7/2013
6/6/2013
6/6/2013
6/5/2013
6/5/2013
6/5/2013
6/5/2013
6/4/2013
6/4/2013
6/3/2013
6/3/2013
6/3/2013
5/29/2013
5/29/2013
5/29/2013
5/29/2013
5/29/2013
5/28/2013
5/28/2013
5/28/2013
5/28/2013
5/27/2013
5/27/2013
5/25/2013
5/25/2013
5/24/2013
5/24/2013
5/23/2013
5/23/2013
5/23/2013
5/23/2013
5/22/2013
5/22/2013
5/22/2013
5/21/2013
5/21/2013
5/21/2013
5/21/2013
5/21/2013
5/20/2013
5/20/2013
5/20/2013
5/20/2013
5/17/2013
5/17/2013
5/17/2013
5/16/2013
5/16/2013
5/14/2013
5/14/2013
5/14/2013
5/13/2013
5/13/2013
5/10/2013
5/10/2013
5/10/2013
5/9/2013
5/9/2013
5/9/2013
5/8/2013
5/8/2013
5/8/2013
5/7/2013
5/7/2013
5/6/2013
5/3/2013
5/2/2013
4/29/2013
4/26/2013
4/25/2013
4/25/2013
4/24/2013
4/24/2013
4/19/2013
4/19/2013
4/18/2013
4/17/2013
4/17/2013
4/16/2013
4/16/2013
4/15/2013
4/15/2013
4/12/2013
4/10/2013
4/10/2013
4/10/2013
4/9/2013
4/8/2013
4/5/2013
4/4/2013
4/4/2013
4/3/2013
4/3/2013
4/2/2013
3/28/2013
3/28/2013
3/27/2013
3/27/2013
3/27/2013
3/26/2013
3/26/2013
3/25/2013
3/25/2013
3/22/2013
3/20/2013
3/20/2013
3/19/2013
3/19/2013
3/18/2013
3/15/2013
3/15/2013
3/14/2013
3/13/2013
3/13/2013
3/12/2013
3/12/2013
3/11/2013
3/8/2013
3/8/2013
3/7/2013
3/6/2013
3/6/2013
3/6/2013
3/4/2013
3/4/2013
2/28/2013
2/28/2013
2/28/2013
2/27/2013
2/26/2013
2/26/2013
2/25/2013
2/25/2013
2/22/2013
2/22/2013
2/22/2013
2/21/2013
2/21/2013
2/20/2013
2/20/2013
2/20/2013
2/19/2013
2/19/2013
2/18/2013
2/18/2013
2/16/2013
2/15/2013
2/15/2013
2/15/2013
2/14/2013
2/14/2013
2/14/2013
2/13/2013
2/13/2013
2/13/2013
2/13/2013
2/12/2013
2/11/2013
2/11/2013
2/8/2013
2/8/2013
2/8/2013
2/8/2013
2/7/2013
2/7/2013
2/6/2013
2/6/2013
2/6/2013
2/5/2013
2/4/2013
2/4/2013
2/1/2013
2/1/2013
2/1/2013
2/1/2013
1/31/2013
1/31/2013
1/30/2013
1/30/2013
1/30/2013
1/29/2013
1/29/2013
1/28/2013
1/28/2013
1/25/2013
1/25/2013
1/25/2013
1/24/2013
1/23/2013
1/23/2013
1/23/2013
1/23/2013
1/22/2013
1/22/2013
1/22/2013
1/22/2013
1/22/2013
1/21/2013
1/21/2013
1/18/2013
1/18/2013
1/18/2013
1/17/2013
1/17/2013
1/16/2013
1/16/2013
1/15/2013
1/15/2013
1/15/2013
1/14/2013
1/14/2013
1/12/2013
1/11/2013
1/11/2013
1/11/2013
1/10/2013
1/10/2013
1/10/2013
1/10/2013
1/9/2013
1/9/2013
1/8/2013
1/8/2013
1/8/2013
1/7/2013
1/7/2013
1/7/2013
1/3/2013
1/3/2013
1/3/2013
1/3/2013
12/28/2012
12/28/2012
12/28/2012
12/27/2012
12/21/2012
12/21/2012
12/21/2012
12/21/2012
12/20/2012
12/20/2012
12/19/2012
12/19/2012
12/19/2012
12/18/2012
12/18/2012
12/18/2012
12/18/2012
12/17/2012
12/17/2012
12/14/2012
12/14/2012
12/14/2012
12/13/2012
12/13/2012
12/13/2012
12/13/2012
12/12/2012
12/12/2012
12/12/2012
12/11/2012
12/11/2012
12/11/2012
12/11/2012
12/11/2012
12/10/2012
12/10/2012
12/10/2012
12/10/2012
12/10/2012
12/7/2012
12/7/2012
12/7/2012
12/6/2012
12/6/2012
12/6/2012
12/5/2012
12/4/2012
12/4/2012
12/4/2012
12/4/2012
12/4/2012
12/3/2012
12/3/2012
12/3/2012
11/30/2012
11/30/2012
11/30/2012
11/29/2012
11/29/2012
11/29/2012
11/29/2012
11/28/2012
11/28/2012
11/28/2012
11/27/2012
11/27/2012
11/27/2012
11/27/2012
11/26/2012
11/26/2012
11/26/2012
11/26/2012
11/26/2012
11/23/2012
11/23/2012
11/23/2012
11/23/2012
11/22/2012
11/22/2012
11/22/2012
11/22/2012
11/22/2012
11/22/2012
11/21/2012
11/21/2012
11/21/2012
11/21/2012
11/21/2012
11/21/2012
11/20/2012
11/20/2012
11/20/2012
11/20/2012
11/19/2012
11/19/2012
11/19/2012
11/19/2012
11/19/2012
11/16/2012
11/16/2012
11/16/2012
11/16/2012
11/16/2012
11/15/2012
11/15/2012
11/14/2012
11/14/2012
11/14/2012
11/13/2012
11/13/2012
11/13/2012
11/12/2012
11/12/2012
11/10/2012
11/9/2012
11/9/2012
11/9/2012
11/8/2012
11/8/2012
11/8/2012
11/8/2012
11/7/2012
11/7/2012
11/6/2012
11/6/2012
11/6/2012
11/6/2012
11/6/2012
11/5/2012
11/5/2012
11/5/2012
11/2/2012
11/2/2012
10/31/2012
10/31/2012
10/31/2012
10/31/2012
10/31/2012
10/30/2012
10/30/2012
10/30/2012
10/30/2012
10/30/2012
10/29/2012
10/29/2012
10/29/2012
10/28/2012
10/28/2012
10/28/2012
10/26/2012
10/26/2012
10/25/2012
10/25/2012
10/24/2012
10/24/2012
10/24/2012
10/24/2012
10/24/2012
10/23/2012
10/23/2012
10/23/2012
10/23/2012
10/22/2012
10/22/2012
10/19/2012
10/19/2012
10/19/2012
10/18/2012
10/18/2012
10/18/2012
10/17/2012
10/17/2012
10/17/2012
10/17/2012
10/17/2012
10/16/2012
10/16/2012
10/16/2012
10/16/2012
10/15/2012
10/15/2012
10/15/2012
10/15/2012
10/12/2012
10/12/2012
10/12/2012
10/11/2012
10/11/2012
10/11/2012
10/11/2012
10/10/2012
10/10/2012
10/10/2012
10/10/2012
10/10/2012
10/9/2012
10/9/2012
10/9/2012
10/8/2012
10/8/2012
10/5/2012
10/5/2012
10/5/2012
10/5/2012
10/5/2012
10/5/2012
10/4/2012
10/4/2012
10/4/2012
10/3/2012
10/3/2012
10/3/2012
10/3/2012
10/2/2012
10/2/2012
10/1/2012
10/1/2012
10/1/2012
9/28/2012
9/28/2012
9/28/2012
9/28/2012
9/27/2012
9/27/2012
9/27/2012
9/27/2012
9/27/2012
9/26/2012
9/26/2012
9/26/2012
9/26/2012
9/26/2012
9/26/2012
9/26/2012
9/25/2012
9/25/2012
9/25/2012
9/24/2012
9/24/2012
9/24/2012
9/24/2012
9/24/2012
9/21/2012
9/21/2012
9/21/2012
9/21/2012
9/20/2012
9/20/2012
9/19/2012
9/19/2012
9/19/2012
9/19/2012
9/18/2012
9/18/2012
9/17/2012
9/17/2012
9/17/2012
9/17/2012
9/17/2012
9/14/2012
9/14/2012
9/14/2012
9/13/2012
9/12/2012
9/12/2012
9/11/2012
9/11/2012
9/11/2012
9/11/2012
9/11/2012
9/11/2012
9/10/2012
9/10/2012
9/10/2012
9/7/2012
9/7/2012
9/7/2012
9/6/2012
9/6/2012
9/5/2012
9/5/2012
9/5/2012
9/5/2012
9/4/2012
9/4/2012
9/4/2012
9/3/2012
9/3/2012
9/3/2012
9/3/2012
9/3/2012
8/31/2012
8/31/2012
8/31/2012
8/30/2012
8/30/2012
8/30/2012
8/29/2012
8/29/2012
8/29/2012
8/29/2012
8/29/2012
8/28/2012
8/28/2012
8/28/2012
8/28/2012
8/27/2012
8/27/2012
8/27/2012
8/24/2012
8/24/2012
8/24/2012
8/23/2012
8/23/2012
8/23/2012
8/23/2012
8/22/2012
8/22/2012
8/22/2012
8/21/2012
8/21/2012
8/21/2012
8/21/2012
8/21/2012
8/21/2012
8/21/2012
8/16/2012
8/16/2012
8/14/2012
8/14/2012
8/14/2012
8/13/2012
8/13/2012
8/13/2012
8/9/2012
8/9/2012
8/9/2012
8/9/2012
8/9/2012
8/9/2012
8/8/2012
8/7/2012
8/7/2012
8/7/2012
8/7/2012
8/7/2012
8/6/2012
8/6/2012
8/3/2012
8/3/2012
8/3/2012
8/3/2012
8/2/2012
8/2/2012
8/2/2012
8/2/2012
8/1/2012
8/1/2012
8/1/2012
7/31/2012
7/31/2012
7/31/2012
7/31/2012
7/31/2012
7/30/2012
7/30/2012
7/30/2012
7/27/2012
7/27/2012
7/26/2012
7/26/2012
7/26/2012
7/25/2012
7/24/2012
7/24/2012
7/24/2012
7/24/2012
7/23/2012
7/23/2012
7/23/2012
7/23/2012
7/23/2012
7/20/2012
7/19/2012
7/19/2012
7/19/2012
7/18/2012
7/18/2012
7/18/2012
7/18/2012
7/18/2012
7/17/2012
7/17/2012
7/17/2012
7/16/2012
7/16/2012
7/16/2012
7/13/2012
7/12/2012
7/12/2012
7/12/2012
7/11/2012
7/11/2012
7/11/2012
7/10/2012
7/10/2012
7/9/2012
7/9/2012
7/6/2012
7/6/2012
7/5/2012
7/5/2012
7/5/2012
7/5/2012
7/4/2012
7/4/2012
7/4/2012
7/3/2012
7/3/2012
7/2/2012
7/2/2012
7/2/2012
6/29/2012
6/29/2012
6/29/2012
6/29/2012
6/28/2012
6/27/2012
6/27/2012
6/27/2012
6/27/2012
6/27/2012
6/26/2012
6/26/2012
6/26/2012
6/25/2012
6/25/2012
6/25/2012
6/25/2012
6/22/2012
6/22/2012
6/21/2012
6/21/2012
6/20/2012
6/20/2012
6/20/2012
6/19/2012
6/19/2012
6/19/2012
6/18/2012
6/18/2012
6/18/2012
6/15/2012
6/15/2012
6/15/2012
6/14/2012
6/13/2012
6/13/2012
6/13/2012
6/12/2012
6/12/2012
6/12/2012
6/12/2012
6/11/2012
6/7/2012
6/6/2012
6/6/2012
6/6/2012
6/5/2012
6/5/2012
6/4/2012
6/1/2012
6/1/2012
6/1/2012
5/31/2012
5/31/2012
5/31/2012
5/31/2012
5/30/2012
5/30/2012
5/30/2012
5/30/2012
5/30/2012
5/30/2012
5/30/2012
5/29/2012
5/29/2012
5/28/2012
5/28/2012
5/28/2012
5/28/2012
5/28/2012
5/25/2012
5/25/2012
5/25/2012
5/25/2012
5/24/2012
5/24/2012
5/24/2012
5/24/2012
5/23/2012
5/23/2012
5/23/2012
5/22/2012
5/22/2012
5/21/2012
5/21/2012
5/21/2012
5/21/2012
5/21/2012
5/18/2012
5/18/2012
5/18/2012
5/17/2012
5/17/2012
5/17/2012
5/16/2012
5/16/2012
5/15/2012
5/15/2012
5/15/2012
5/14/2012
5/14/2012
5/14/2012
5/11/2012
5/11/2012
5/11/2012
5/10/2012
5/10/2012
5/10/2012
5/9/2012
5/9/2012
5/9/2012
5/9/2012
5/8/2012
5/8/2012
5/7/2012
5/7/2012
5/7/2012
5/4/2012
4/30/2012
4/27/2012
4/27/2012
4/27/2012
4/27/2012
4/27/2012
4/26/2012
4/26/2012
4/26/2012
4/26/2012
4/25/2012
4/25/2012
4/25/2012
4/24/2012
4/24/2012
4/24/2012
4/23/2012
4/23/2012
4/23/2012
4/20/2012
4/20/2012
4/20/2012
4/19/2012
4/19/2012
4/18/2012
4/17/2012
4/17/2012
4/17/2012
4/16/2012
4/16/2012
4/16/2012
4/16/2012
4/16/2012
4/13/2012
4/12/2012
4/12/2012
4/12/2012
4/11/2012
4/11/2012
4/11/2012
4/11/2012
4/10/2012
4/6/2012
4/6/2012
4/6/2012
4/4/2012
4/4/2012
4/3/2012
4/2/2012
4/2/2012
4/2/2012
3/30/2012
3/30/2012
3/30/2012
3/30/2012
3/29/2012
3/29/2012
3/29/2012
3/28/2012
3/28/2012
3/28/2012
3/27/2012
3/27/2012
3/27/2012
3/26/2012
3/26/2012
3/26/2012
3/26/2012
3/24/2012
3/23/2012
3/23/2012
3/22/2012
3/22/2012
3/22/2012
3/21/2012
3/21/2012
3/21/2012
3/20/2012
3/20/2012
3/19/2012
3/19/2012
3/16/2012
3/16/2012
3/16/2012
3/16/2012
3/16/2012
3/16/2012
3/16/2012
3/15/2012
3/15/2012
3/15/2012
3/13/2012
3/13/2012
3/12/2012
3/12/2012
3/12/2012
3/12/2012
3/8/2012
3/8/2012
3/7/2012
3/7/2012
3/6/2012
3/6/2012
3/6/2012
3/5/2012
3/5/2012
3/5/2012
3/2/2012
3/2/2012
3/1/2012
3/1/2012
2/29/2012
2/29/2012
2/29/2012
2/29/2012
2/29/2012
2/28/2012
2/28/2012
2/28/2012
2/28/2012
2/27/2012
2/27/2012
2/27/2012
2/27/2012
2/24/2012
2/23/2012
2/23/2012
2/22/2012
2/22/2012
2/22/2012
2/21/2012
2/21/2012
2/21/2012
2/21/2012
2/21/2012
2/21/2012
2/21/2012
2/17/2012
2/17/2012
2/16/2012
2/15/2012
2/15/2012
2/15/2012
2/15/2012
2/15/2012
2/14/2012
2/14/2012
2/14/2012
2/13/2012
2/13/2012
2/13/2012
2/13/2012
2/10/2012
2/10/2012
2/9/2012
2/9/2012
2/9/2012
2/9/2012
2/8/2012
2/8/2012
2/8/2012
2/8/2012
2/7/2012
2/7/2012
2/6/2012
2/6/2012
2/3/2012
2/3/2012
2/3/2012
2/2/2012
2/2/2012
2/1/2012
2/1/2012
1/31/2012
1/31/2012
1/31/2012
1/30/2012
1/30/2012
1/30/2012
1/30/2012
1/30/2012
1/27/2012
1/27/2012
1/26/2012
1/26/2012
1/26/2012
1/26/2012
1/25/2012
1/25/2012
1/25/2012
1/24/2012
1/24/2012
1/24/2012
1/24/2012
1/24/2012
1/23/2012
1/23/2012
1/23/2012
1/20/2012
1/20/2012
1/19/2012
1/19/2012
1/19/2012
1/19/2012
1/18/2012
1/18/2012
1/18/2012
1/18/2012
1/18/2012
1/17/2012
1/17/2012
1/16/2012
1/16/2012
1/16/2012
1/13/2012
1/13/2012
1/13/2012
1/12/2012
1/11/2012
1/11/2012
1/11/2012
1/10/2012
1/10/2012
1/10/2012
1/10/2012
1/10/2012
1/9/2012
1/9/2012
1/5/2012
1/5/2012
1/4/2012
1/4/2012
1/4/2012
1/2/2012
1/2/2012
12/29/2011
12/29/2011
12/29/2011
12/28/2011
12/28/2011
12/28/2011
12/27/2011
12/25/2011
12/23/2011
12/23/2011
12/23/2011
12/22/2011
12/22/2011
12/22/2011
12/21/2011
12/21/2011
12/21/2011
12/21/2011
12/21/2011
12/21/2011
12/20/2011
12/20/2011
12/20/2011
12/20/2011
12/20/2011
12/20/2011
12/19/2011
12/19/2011
12/17/2011
12/16/2011
12/16/2011
12/15/2011
12/15/2011
12/15/2011
12/15/2011
12/15/2011
12/14/2011
12/14/2011
12/13/2011
12/13/2011
12/12/2011
12/12/2011
12/12/2011
12/12/2011
12/12/2011
12/10/2011
12/9/2011
12/8/2011
12/8/2011
12/8/2011
12/8/2011
12/8/2011
12/8/2011
12/7/2011
12/6/2011
12/6/2011
12/6/2011
12/6/2011
12/5/2011
12/5/2011
12/5/2011
12/5/2011
12/2/2011
12/2/2011
12/2/2011
12/2/2011
12/2/2011
12/1/2011
12/1/2011
12/1/2011
12/1/2011
12/1/2011
11/30/2011
11/30/2011
11/30/2011
11/30/2011
11/29/2011
11/29/2011
11/29/2011
11/29/2011
11/28/2011
11/28/2011
11/28/2011
11/26/2011
11/26/2011
11/25/2011
11/25/2011
11/25/2011
11/24/2011
11/24/2011
11/24/2011
11/24/2011
11/23/2011
11/23/2011
11/23/2011
11/23/2011
11/23/2011
11/22/2011
11/22/2011
11/22/2011
11/21/2011
11/21/2011
11/21/2011
11/18/2011
11/18/2011
11/17/2011
11/17/2011
11/17/2011
11/17/2011
11/17/2011
11/17/2011
11/17/2011
11/16/2011
11/16/2011
11/16/2011
11/16/2011
11/16/2011
11/15/2011
11/15/2011
11/15/2011
11/14/2011
11/14/2011
11/14/2011
11/14/2011
11/11/2011
11/11/2011
11/10/2011
11/10/2011
11/10/2011
11/10/2011
11/10/2011
11/9/2011
11/8/2011
11/8/2011
11/8/2011
11/8/2011
11/8/2011
11/8/2011
11/7/2011
11/7/2011
11/7/2011
11/7/2011
11/4/2011
11/4/2011
11/4/2011
11/3/2011
11/3/2011
11/3/2011
11/2/2011
11/2/2011
11/2/2011
11/2/2011
11/2/2011
10/31/2011
10/28/2011
10/28/2011
10/28/2011
10/27/2011
10/27/2011
10/27/2011
10/27/2011
10/27/2011
10/26/2011
10/26/2011
10/26/2011
10/25/2011
10/25/2011
10/25/2011
10/25/2011
10/25/2011
10/24/2011
10/24/2011
10/24/2011
10/21/2011
10/21/2011
10/21/2011
10/21/2011
10/21/2011
10/20/2011
10/20/2011
10/20/2011
10/20/2011
10/19/2011
10/19/2011
10/19/2011
10/19/2011
10/19/2011
10/18/2011
10/18/2011
10/17/2011
10/17/2011
10/17/2011
10/17/2011
10/17/2011
10/14/2011
10/14/2011
10/14/2011
10/14/2011
10/13/2011
10/13/2011
10/13/2011
10/13/2011
10/13/2011
10/12/2011
10/12/2011
10/11/2011
10/11/2011
10/11/2011
10/11/2011
10/11/2011
10/11/2011
10/10/2011
10/10/2011
10/10/2011
10/7/2011
10/7/2011
10/7/2011
10/7/2011
10/6/2011
10/6/2011
10/6/2011
10/5/2011
10/5/2011
10/5/2011
10/5/2011
10/4/2011
10/4/2011
10/4/2011
10/3/2011
10/3/2011
10/2/2011
9/30/2011
9/30/2011
9/30/2011
9/30/2011
9/29/2011
9/29/2011
9/29/2011
9/29/2011
9/28/2011
9/28/2011
9/28/2011
9/28/2011
9/28/2011
9/27/2011
9/27/2011
9/27/2011
9/27/2011
9/26/2011
9/26/2011
9/26/2011
9/26/2011
9/26/2011
9/26/2011
9/26/2011
9/23/2011
9/23/2011
9/22/2011
9/22/2011
9/22/2011
9/21/2011
9/21/2011
9/21/2011
9/20/2011
9/20/2011
9/20/2011
9/20/2011
9/19/2011
9/19/2011
9/19/2011
9/19/2011
9/19/2011
9/17/2011
9/16/2011
9/16/2011
9/16/2011
9/16/2011
9/15/2011
9/15/2011
9/15/2011
9/15/2011
9/15/2011
9/14/2011
9/13/2011
9/13/2011
9/13/2011
9/13/2011
9/13/2011
9/12/2011
9/12/2011
9/12/2011
9/12/2011
9/9/2011
9/9/2011
9/9/2011
9/8/2011
9/8/2011
9/8/2011
9/7/2011
9/7/2011
9/6/2011
9/6/2011
9/6/2011
9/5/2011
9/5/2011
9/5/2011
9/2/2011
9/2/2011
9/1/2011
9/1/2011
9/1/2011
9/1/2011
8/31/2011
8/31/2011
8/31/2011
8/31/2011
8/31/2011
8/30/2011
8/30/2011
8/30/2011
8/30/2011
8/29/2011
8/29/2011
8/29/2011
8/29/2011
8/29/2011
8/29/2011
8/26/2011
8/26/2011
8/26/2011
8/26/2011
8/25/2011
8/25/2011
8/25/2011
8/25/2011
8/24/2011
8/24/2011
8/23/2011
8/23/2011
8/23/2011
8/23/2011
8/22/2011
8/22/2011
8/22/2011
8/22/2011
8/22/2011
8/22/2011
8/20/2011
8/19/2011
8/19/2011
8/19/2011
8/19/2011
8/18/2011
8/18/2011
8/18/2011
8/18/2011
8/18/2011
8/17/2011
8/17/2011
8/17/2011
8/16/2011
8/16/2011
8/16/2011
8/12/2011
8/12/2011
8/12/2011
8/12/2011
8/11/2011
8/11/2011
8/10/2011
8/10/2011
8/10/2011
8/10/2011
8/9/2011
8/9/2011
8/9/2011
8/8/2011
8/8/2011
8/8/2011
8/8/2011
8/8/2011
8/5/2011
8/5/2011
8/4/2011
8/4/2011
8/4/2011
8/3/2011
8/3/2011
8/3/2011
8/3/2011
8/2/2011
8/2/2011
8/2/2011
8/1/2011
8/1/2011
8/1/2011
8/1/2011
8/1/2011
7/30/2011
7/29/2011
7/29/2011
7/28/2011
7/28/2011
7/28/2011
7/28/2011
7/28/2011
7/28/2011
7/27/2011
7/26/2011
7/26/2011
7/25/2011
7/25/2011
7/25/2011
7/25/2011
7/22/2011
7/22/2011
7/22/2011
7/21/2011
7/21/2011
7/21/2011
7/20/2011
7/20/2011
7/19/2011
7/19/2011
7/19/2011
7/19/2011
7/18/2011
7/18/2011
7/15/2011
7/15/2011
7/15/2011
7/15/2011
7/14/2011
7/13/2011
7/13/2011
7/12/2011
7/11/2011
7/8/2011
7/8/2011
7/8/2011
7/8/2011
7/7/2011
7/7/2011
7/6/2011
7/6/2011
7/6/2011
7/6/2011
7/5/2011
7/5/2011
7/5/2011
7/5/2011
7/4/2011
7/4/2011
7/1/2011
7/1/2011
7/1/2011
7/1/2011
6/30/2011
6/29/2011
6/29/2011
6/29/2011
6/29/2011
6/28/2011
6/28/2011
6/28/2011
6/28/2011
6/28/2011
6/27/2011
6/27/2011
6/27/2011
6/27/2011
6/22/2011
6/22/2011
6/22/2011
6/21/2011
6/21/2011
6/21/2011
6/20/2011
6/20/2011
6/20/2011
6/17/2011
6/17/2011
6/17/2011
6/16/2011
6/16/2011
6/15/2011
6/15/2011
6/15/2011
6/14/2011
6/14/2011
6/14/2011
6/13/2011
6/13/2011
6/13/2011
6/10/2011
6/10/2011
6/10/2011
6/10/2011
6/10/2011
6/9/2011
6/9/2011
6/8/2011
6/8/2011
6/8/2011
6/7/2011
6/6/2011
6/6/2011
6/3/2011
6/3/2011
6/2/2011
6/2/2011
6/2/2011
6/2/2011
6/2/2011
6/2/2011
6/1/2011
6/1/2011
6/1/2011
6/1/2011
5/31/2011
5/31/2011
5/31/2011
5/31/2011
5/30/2011
5/28/2011
5/28/2011
5/27/2011
5/27/2011
5/27/2011
5/27/2011
5/26/2011
5/26/2011
5/25/2011
5/25/2011
5/24/2011
5/24/2011
5/23/2011
5/23/2011
5/23/2011
5/23/2011
5/20/2011
5/19/2011
5/19/2011
5/18/2011
5/18/2011
5/17/2011
5/17/2011
5/16/2011
5/16/2011
5/16/2011
5/16/2011
5/14/2011
5/13/2011
5/13/2011
5/13/2011
5/12/2011
5/12/2011
5/12/2011
5/11/2011
5/11/2011
5/11/2011
5/10/2011
5/10/2011
5/10/2011
5/10/2011
5/9/2011
5/7/2011
5/6/2011
5/6/2011
5/6/2011
5/5/2011
5/5/2011
5/5/2011
5/4/2011
5/4/2011
5/4/2011
4/30/2011
4/29/2011
4/29/2011
4/28/2011
4/28/2011
4/28/2011
4/27/2011
4/27/2011
4/27/2011
4/26/2011
4/26/2011
4/26/2011
4/22/2011
4/22/2011
4/22/2011
4/22/2011
4/21/2011
4/21/2011
4/20/2011
4/20/2011
4/20/2011
4/20/2011
4/19/2011
4/19/2011
4/19/2011
4/19/2011
4/18/2011
4/18/2011
4/18/2011
4/15/2011
4/14/2011
4/14/2011
4/13/2011
4/13/2011
4/12/2011
4/11/2011
4/11/2011
4/8/2011
4/7/2011
4/6/2011
4/6/2011
4/6/2011
4/6/2011
4/5/2011
4/1/2011
4/1/2011
4/1/2011
3/31/2011
3/31/2011
3/30/2011
3/30/2011
3/30/2011
3/29/2011
3/28/2011
3/28/2011
3/28/2011
3/25/2011
3/24/2011
3/23/2011
3/23/2011
3/22/2011
3/21/2011
3/18/2011
3/17/2011
3/17/2011
3/16/2011
3/15/2011
3/14/2011
3/14/2011
3/11/2011
3/10/2011
3/9/2011
3/9/2011
3/8/2011
3/8/2011
3/7/2011
3/4/2011
3/4/2011
3/4/2011
3/3/2011
3/3/2011
3/2/2011
3/1/2011
3/1/2011
3/1/2011
2/28/2011
2/28/2011
2/25/2011
2/25/2011
2/24/2011
2/24/2011
2/24/2011
2/23/2011
2/22/2011
2/22/2011
2/21/2011
2/21/2011
2/18/2011
2/18/2011
2/17/2011
2/16/2011
2/15/2011
2/14/2011
2/14/2011
2/11/2011
2/10/2011
2/9/2011
2/9/2011
2/8/2011
2/7/2011
2/7/2011
2/4/2011
2/4/2011
2/4/2011
2/3/2011
2/2/2011
2/2/2011
2/1/2011
1/31/2011
1/28/2011
1/28/2011
1/27/2011
1/27/2011
1/26/2011
1/26/2011
1/25/2011
1/25/2011
1/24/2011
1/21/2011
1/20/2011
1/20/2011
1/19/2011
1/18/2011
1/17/2011
1/17/2011
1/14/2011
1/13/2011
1/12/2011
 

vijay65 17 posts Joined 10/13
26 Nov 2013

sorry
by mistake all record have been posted

qbeg 3 posts Joined 11/12
26 Nov 2013

I don't know whether well I understood the problem, if it is a following code should help:

SELECT top 1000 order_date FROM database.table
where order_date>=add_months(current_date,-6)
order by order_date

In case of questions I stay for the instruction:)

Best regards
Peter

qbeg 3 posts Joined 11/12
26 Nov 2013

Or the same as the Khurram suggested higher, that is:

SELECT top 1000 order_date FROM Database.tablename
where order_date>=(current_date - interval '6' month)
order by order_date

 
Best regards
Peter
 

M.Saeed Khurram 544 posts Joined 09/12
26 Nov 2013

I just needed one value just to check the date format :)
You can follow peters solution, if it is not working please let me know.
 

Khurram

Kawish_Siddiqui 37 posts Joined 03/07
26 Nov 2013

Are you looking something like this:

 

What I could understand from question is, you have two seperate tables and want to sum a column value based on Order_Date filter (last six months) by joning two tables on Opportunity_ID.... Am I right?

 

In this case, SQL will look like this.

Select Sum(OPP.Expected_Amount)
From Opportunity OPP
Inner Join Sales SL
On OPP.Opportunity_ID = SL.Opportunity_ID
Where SL.Order_Date >= add_months(current_date,-6)

 

 

Kawish Siddiqui -

vijay65 17 posts Joined 10/13
26 Nov 2013

really usefull kawish.
thanks

saranyaNithya 2 posts Joined 01/15
08 Jan 2015

SELECT top 1000 order_date FROM Database.tablename

where order_date>=(current_date - interval '6' month)

order by order_date

 

in this query, instead of current date , I wanna use the max(order_date). but it is not working. How do i filter from maximum data in the table to six months earlier date.

 

 

ravimans 54 posts Joined 02/14
09 Jan 2015

Hi Saranya,
Let me know if this works for you.

sel order_date FROM Database.tablename tb1,

(sel max(order_date) as mdate FROM Database.tablename) tb2

where order_date between add_months(mdate,-6) and mdate;

You must sign in to leave a comment.