Microsoft
Software
Hardware
Network
Question : SQL Query to return Count in Table 2 while also returning the row in Table 1.
I have 2 tables in which im looking for a query using a Join to return the record in Table 1 with a count of all the related rows in Table 2.
Table 1: Content
--------------------------
--
ContentID
ContentName
ContentDesc
Table 2: UserComments
--------------------------
--
CommentID
ContentID
UserName
Comment
The join would be on ContentID in both tables.
Im trying to return 1 row with 4 Columns. ContentID,ContentName,Cont
entDesc,Co
mmentCount
CommentCount would = Count(*) as CommentCount
Thanks
Answer : SQL Query to return Count in Table 2 while also returning the row in Table 1.
select a.contentid, a.contentName, a.contentdesc, (select count(commentid) from UserComments where contentid = a.contentid) 'Comment Count' from Content A
Random Solutions
Need Help.. couldn't find my problem
C# Brain Bench Question
Access 2007 - Flush Fields
How does this really work - DoCmd.DoMenuItem A_FORMBAR, A_FILEMENU, A_SAVERECORD
cannot access win xp system in workgroup
Drop Down List and Back Button on Browser - Losing state?
Outlook problem with error 0x80040154 (and others) -- inetcomm issue?
Finding Null in a memo field and what event to use to check the related box
Automatically close Outlook on log off or shutdown
Validating users with three level security