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.
| Author |
Topic |
|
vidhya
Posting Yak Master
108 Posts |
Posted - 2008-09-30 : 07:39:36
|
| i am using 3 tablesnamely kr_reference,kr_referencerating,kr_referencehistory.In kr_reference table i m having column -->refidin kr_referencerating table i m having--> ratid,refid,pointsin kr_referencehistory table i m having -->lid,refid,titleFrom this table i need to display the title and total sum of points corresponding to the refids. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-30 : 07:52:06
|
Use JOINs between tables. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
vidhya
Posting Yak Master
108 Posts |
Posted - 2008-09-30 : 07:54:13
|
| peso,select h.title as title,sum(r.points) as total from kr_referencerating r,kr_reference f,kr_category c, kr_referencehistory h where h.refid=f.refid and f.catid=c.catid and r.refid=f.refid and r.deleted=0 group by f.refid,h.titlei used this query to display sum of points and title. i need to display ratid too. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-30 : 07:54:20
|
| [code]SELECT rh.title,SUM(r.points) AS SumofPointsFROM kr_referencerating rINNER JOIN kr_referencehistory rhON rh.refid=r.refidGROUP BY rh.title[/code] |
 |
|
|
|
|
|
|
|