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 |
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2009-02-09 : 10:34:01
|
| hiI have a table(Type) with values A,B,C,DI want to add a "All" value from a selectFor example Select Type from Tableunion allSelect 'A'This would result inAllABCDHow should i go about it? Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-02-09 : 10:37:00
|
| Select 'All'union allSelect Type from TableMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-09 : 10:43:35
|
| [code]SELECT ValFROM(Select Type AS Val,1 AS Ord from Tableunion allSelect 'All',0)tORDER BY Ord[/code] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-02-09 : 10:46:08
|
quote: Originally posted by visakh16
SELECT ValFROM(Select Type AS Val,1 AS Ord from Tableunion allSelect 'All',0)tORDER BY Ord
You dont need it when you use UNION ALLMadhivananFailing to plan is Planning to fail |
 |
|
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2009-02-09 : 12:24:20
|
| Thank you so much. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-09 : 12:32:39
|
welcome |
 |
|
|
|
|
|