Hi, everyone...
I have a question about sql ..

Question:

Customer | jan-april | may - august| september - december

A |quantity | |

B | | |

C | | |


How to use the SELECT command to retrieve data and the output is show like above.
please give me some examples.

What is the table structure ?

What have you tried so far ?

You got any similar example can show me....?

change your columns names accordingly

select customer, sum(case when month(datecolname) in (1,2,3) then quantity else 0 end) jan_mar
sum(case when month(datecolname) in (4,5,6) then quantity else 0 end) apr_jun,
sum(case when month(datecolname) in (7,8,9) then quantity else 0 end) jul_sep,
sum(case when month(datecolname) in (10,11,12) then quantity else 0 end) oct_dec
from tablename
where  month(getdate())=2011
group by customer

urtrivedi's script should work, provided that the where is :

where year(datecolname) = '2011'

or something similar.

YA ...i know that one....thx..the problem had been solved....

Great. You learn best when you try things out yourself.