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 |
|
mkool
Starting Member
25 Posts |
Posted - 2008-03-24 : 13:31:29
|
| create view vwchannelasselect distinct s2.soptype, s2.sopnumbe , --internet orders/information center orderss2.custnmbr , --amazon.com orderss3,itemnmbr, sum(s3.quantity) from salestab s2left outer join (select distinct soptype,sopnumbe,itemnmbr,quantity from salesdisttab) s3on s2.soptype = s3.soptype and s2.sopnumbe = s3.sopnumbe where (s2.CUSTNMBR LIKE 'amazon%') AND ((s2.SOPNUMBE LIKE 'net%') OR (s2.SOPNUMBE LIKE 'inv%'))AND s2.soptype = 3group by s3.itemnmbr,s2.sopnumbe,s2.custnmbr,s2.soptypegoi m getting 70 rows in output which is correct but..i have to combine sopnumbe and custnmbr into one column name as channelhow can i do that?i tried like:case when (s2.SOPNUMBE LIKE 'net%' OR s2.SOPNUMBE LIKE 'inv%') then s2.sopnumbewhen s2.CUSTNMBR LIKE 'amazon%' then s2.custnmbrend as channelbut i m getting 0rows affected in ouput.. instead of 70rows...can anyone help me?thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-24 : 13:51:42
|
| where do you want to combine columns? in WHERE condition? |
 |
|
|
mkool
Starting Member
25 Posts |
Posted - 2008-03-24 : 13:59:53
|
| thanks for replying..i want in select clause in output..it should be channel instead of sopnumbe,custnmbrthanks. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-24 : 14:26:26
|
| use concatenation operator to achieve thiss2.sopnumbe + s2.custnmbr as channel |
 |
|
|
|
|
|