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 |
jimmy2090
Starting Member
26 Posts |
Posted - 2015-04-29 : 22:30:39
|
hi all, i want to combine 2 columns from different table.let said my table1:id: A1 customername: WesternDigitalid: A2 customername: Sonyid: A3 customername: Samsungmy table2 :id: A1 customername: Roseid: A3 customername: Johnmy output is like that:customernameWesternDigital, RoseSonySamsung, Johnmy sql as below:select table1.customername + table2.customername as customernamefrom table1inner join table2 on table1.id = table2.id how to make the table1 sony appear also even it does not exist in table2? |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2015-04-30 : 01:40:45
|
@jimmy2090 - You'll need to use a LEFT JOIN as opposed to an INNER JOIN. The LEFT JOIN will include rows from left table plus all joins made with right table.Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
|
|
|