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 |
|
d00b13630
Starting Member
12 Posts |
Posted - 2008-06-11 : 14:39:00
|
| I'm managing an amature online university and I've been charged with creating a deans list. I have a table for exam results for each course.. currently totaling 5. I have an employeeID column and a total_points column in each table. Sooooo I need to join all the tables and get an average for total_points where the employeeID matches across tables. I have no idea how to write this select.. any help? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-06-11 : 14:41:57
|
| [code]SELECT AVG(total_points) AS total_pointsFROM ( SELECT total_points FROM Table1 WHERE employeeID = 1 UNION ALL SELECT total_points FROM Table2 WHERE employeeID = 1 UNION ALL SELECT total_points FROM Table3 WHERE employeeID = 1 UNION ALL SELECT total_points FROM Table4 WHERE employeeID = 1 UNION ALL SELECT total_points FROM Table5 WHERE employeeID = 1) t[/code]Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
|
|
|