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 |
|
empyrean
Starting Member
14 Posts |
Posted - 2009-09-16 : 13:37:36
|
| hii have 4 columns lets say colA,colB,colC and colD having values in atleast 1 column for one row. i need to merge them based on priority and lets say colA priority is 1, colB as 2, colC as 3 and colD as 4. so in one row if there are values in 4 columns, i need to display only priority 1 data. If there is data in colB,colC and colD then i need to display colB data as it has highest priority and other columns have null values..please help me in this ASAP.. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-16 : 13:39:02
|
do you mean thisSELECT COALESCE(ColA,ColB,ColC,ColD) AS Data FROM Table |
 |
|
|
empyrean
Starting Member
14 Posts |
Posted - 2009-09-16 : 13:52:05
|
| Thanks a lot...it worked really well...your reply is very quick..i am sorry for duplicate posting as i dont know whether it comes under new sql programming or transact sql. i wont repeat this..thanks again |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-16 : 13:53:24
|
no worries...you're welcome |
 |
|
|
|
|
|