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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to solve this query

Author  Topic 

imranabdulaziz
Yak Posting Veteran

83 Posts

Posted - 2010-10-07 : 07:37:12

Dear all
I have three tables first is main hdr which contains single records of employee sales , second table contains differnent customer for that month and third is sales details that is it contains items sold to the customer

Like

MainHdrTable
MainHdrID Employee zone month Year
1 abc East 4 2010
2 efg West 4 2010
3 test East 4 2010

CustHeaderTable


CustHdrId MainHdrID Customer
100 1 Esd
101 1 Abc
102 2 Esd
103 3 Wer
103 3 Ter

Sales Details
CustHdrID ItemCode Qty
100 Item1 5
101 Item1 10
101 Item2 4
102 Item1 5
103 Item3 8
100 Item3 10
102 Item2 5
103 Item1 5



Now I need to find out details in following fashion


Month April 2010
item Zone east Zone west Zone north Zone south
Item1 20
Item2 4
Item3 18


Please suggest

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-10-17 : 04:54:33
can you explain how you got values only for eastzone in output? where did west value go?

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

Go to Top of Page
   

- Advertisement -