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 |
Ratamahatta
Starting Member
3 Posts |
Posted - 2008-10-05 : 07:19:13
|
I posted this in the sql 2000 section but it turned out to be an access issue, any help would be appreciated. quote: I have two tables i would like to join to show bonus earned this month and total this year.First table: empl.emplID | Name1 | Bob2 | JamesSecond table: Bonus.empl_id | month | Bonus1 | 1 | 10002 | 1 | 7501 | 2 | 5002 | 2 | 10001 | 3 | 2502 | 3 | 500The output im looking for is (bonus month 3):Name | Bonus this month | Bonus totalBob | 250 | 1750James | 500 | 2250This is the closest i have got and it fails. So if anyone can point me in the right direction i would be very thankful.Failing query:select e.name, sum(b.bonus) as total, sum(b1.bonus) as thismth from (empl as e INNER JOIN bonus as b on e.emplID=b.empl_id) INNER JOIN bonus as b1 on e.emplID=b1.empl_id group by e.name
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-05 : 07:48:47
|
this might help youhttp://support.microsoft.com/kb/290136 |
 |
|
|
|
|