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
 getting total records from first table

Author  Topic 

ramyasre
Starting Member

16 Posts

Posted - 2011-04-28 : 00:47:25
Hi,

The following are two tables

LocationCode FormCode
________________________

10201 op008
10201 op009
10201 op010
10201 ip003
10201 ip005
10202 op008
10202 op010

Another Table is

FormCode Score LocationCode
___________________________________
op008 11 10201
op010 20 10201
op008 4 10201
op009 3 10201
op008 7 10201

Now I want output as follows

FormCode TotalForms LocationCode
________________________________________

op008 3 10201
op009 1 10201
op010 1 10201
ip003 0 10201
ip005 0 10201
op008 0 10202
op010 0 10202

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-28 : 01:14:21
duplicate post: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=160002


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -