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
 Regarding Get Data from Table

Author  Topic 

mailtosaja
Starting Member

28 Posts

Posted - 2008-08-06 : 08:08:55
Hi,
i have two tables it's called ErrorDetails and LevelDetails..Below having the table structure with data

ErrorDetails
S_No ErrorID Descri LevelID
---------------------------------------
1 1 Coding Error 1
2 2 Testing Error NULL
3 3 Review 2
4 1 Coding Error 3
5 1 Test Error 0
6 2 Test 0


LevelDetails
LevelID LevelDescription
----------------------------
0 None
1 Functional!
2 Release Level

I want the data like below structure... In the ErrorDetails
table Null and 0 are the same in LevelID...

ErrorID LevelDescription count


If any body knows the query please tell me

Thanks & Regards,
S.Jess

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-06 : 08:13:47
Select ed.errorid, ld.LevelDescription, count(ed.*) as counting from ErrorDetails as ed inner join LevelDetails as ld on coalesce(ed.LevelID,0)=ld.LevelID group by ed.errorid, ld.LevelDescription

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

mailtosaja
Starting Member

28 Posts

Posted - 2008-08-06 : 08:38:11
Hi,
Incorrect syntax near '*'.
thanks & regards,
S.Jess
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-06 : 08:42:22
Select ed.errorid, ld.LevelDescription, count(*) as counting from ErrorDetails as ed inner join LevelDetails as ld on coalesce(ed.LevelID,0)=ld.LevelID group by ed.errorid, ld.LevelDescription

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -