[quoted text, click to view] >>where date_sales < '01/01/2004 ' and date_sales < '03/31/2004'
This condition doesnt make sense at all.
any date_sales thats less than '01/01/2004 '
is also less than '03/31/2004'. So the second part of
the where clause is unnecessary.
I guess you havent explained your problem well.
But a wild guess is that you are trying to get a pivot-ed report
If thats the case,You can try something like
SELECT Prod_name,
CASE WHEN Year(date_sale) = 2003 THEN pro_sales END As pro_sales_2003 ,
CASE WHEN Year(date_sale) = 2004 THEN pro_sales END As pro_sales_2004
FROM YourTable
--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com [quoted text, click to view] "pierca" <piercasb@tiscalinet.it> wrote in message
news:cf8hqm$2fv$1@newsread.albacom.net...
> Hi All
>
> i have a select statement like this
>
> select pro_name, pro_sales, date_sales from inventory
> where date_sales < '01/01/2004 ' and date_sales < '03/31/2004'
>
> now i need to select another period to compare data
>
> select pro_name, pro_sales, date_sales from inventory
> where date_sales < '01/01/2004 ' and date_sales < '03/31/2004'
>
>
> how can i build the query to get out this result?
>
> pro_name pro_sales_2003 pro_sales_2004
> -----------------------------------------------
>
> thanks
> Pierca
>
>