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 |
|
davidliv
Starting Member
45 Posts |
Posted - 2004-05-22 : 14:46:34
|
| I must be tired, because I can't find an answer to my problem. I must be making things difficult.I have a table which will return 3 records base on a typeID. I need to list those 3 records and provide a 4th row with a total.RecID..TypeName..Amount..1.....Style1....100..2.....Style2....400..3.....Style3....200Total.............700I want to present the "name" of my Type, but set my order by to the typeID. |
|
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-05-22 : 15:07:17
|
| Try this. modify for your specific typeid where clauseselect recid, typename, amount from tablewhere typeid = 2union select null, 'Total', sum(amount) amount --recid will be null for total line. Change to suitfrom tablewhere typeid = 2 |
 |
|
|
davidliv
Starting Member
45 Posts |
Posted - 2004-05-22 : 15:14:12
|
| most excellent. This is exactly what I was looking for. |
 |
|
|
|
|
|