Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Combine two results

$
0
0

help me with below requirement:

here DepartmentID  is common in both the tables

Select name, Empid, DepartmentID from Table1 where name like ’%abc%’

Result :

Name

Empid

DepartmentID

IA_ABC

123

234

ABC

345

NULL

Select name,  DepartmentID from Table1 where name like ’%abc%’

O/P”

Name

Department ID

ABC

234

Expected Result:

Name

Empid

Department ID

IA_ABC

123

234

ABC

345

NULL

ABC

NULL

234

Table 2 contains only name & DepartmentID but not empid




Viewing all articles
Browse latest Browse all 8428

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>