Home > Archive > MS SQL Server MSEQ > August 2005 > How to Join a table with Other (result) Tables ? Complex one !









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to Join a table with Other (result) Tables ? Complex one !
velu

2005-08-25, 7:24 am

Here is the situation

Table 1 : tbl_documents

docID docName
1 aaa
2 bbb
3 ccc

Table 2 : tbl_Rating

ratID rating docID
1 3 1
2 5 1
3 2 1
4 3 2

The queary I need is to display the result in this form. must be like this

docID docName Avaragerating
1 aaa 3
2 bbb 3
3 ccc 0

NOTE : For getting the average I used this queary “SELECT SUM(rating) As
RatingSum, COUNT(*) As RatingCount FROM tbl_Rating WHERE tbl_rating.docID =
tbl_documents.docID”

PLs help me ?

Thx
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com