Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query regarding column structures

Author  Topic 

abhinav.bnrj
Starting Member

1 Post

Posted - 2010-09-21 : 12:53:27
Hi,

Could anyone help me out on the following SQl question:

2. Given a database storing invoices in the table “INV” with the columns “CUSTOMER”, “DATE” and “TOTAL”.
Write a query returning a result set with the following structure:
 
YEAR |Total Customer “C1000” | Total Customer “C1001”
-----------------------------------------------------------------------------------------------------------------------------------------
2001 | 0 | 1000.32
2002 | 100 | 0


Thanks.

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2010-09-21 : 13:30:17
You can use either a CASE statement or a PIVOT operator. Do your best on the query and then show us what you did, even if it doesn't work.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-09-23 : 13:03:44
when's your assignment submission date?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -