December 3, 2012 at 7:10 am
ProjectTable:
ID ProjectID ProjectName
1 PRO14 Demo
2 PRO15 Test
Task Table:
ID ProjectID TaskID TakName
1 PRO14 12 module
2 PRO14 13 code
3 PRO15 14 Design
I want to sql query for
ProjectName TaskCount
Demo 2
Test 1
December 3, 2012 at 7:36 am
select tableA.Col, COUNT(Tableb.ID) as MyCount
from tableA a
join Tableb b on a.ID = b.ID
group by table.Col
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 3, 2012 at 7:38 am
You can look up INNER JOIN and GROUP BY Google or Books Online
Using these two concepts, you can get the desired result
If you face any further issues get back to us with what you have tried,we would be happy to help you out..
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply