Sandeep Raj Shakya
Sandeep Raj Shakya

Reputation: 42

Combining two tables in a query

I am using SQL Server 2008 R2. How can I get the output as provided?

tbl_Configure

Date        Name
1/1/13      Sandeep
1/2/13      Sudeep

tbl_Install

Date        Name
1/1/13      Sandeep
1/2/13      Sandeep

Output:

Date        Name        Type
1/1/13      Sandeep     Configure
1/1/13      Sandeep     Install
1/2/13      Sudeep      Configure
1/2/13      Sandeep     Install

Upvotes: 0

Views: 42

Answers (1)

Pepe
Pepe

Reputation: 6480

Select config.Date, config.Name, 'Configure' as Type From tbl_Configure config
Union
Select install.Date, install.Name, 'Install' as Type From tbl_Install install

Upvotes: 3

Related Questions