Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

Union

$
0
0

Hi

I have three tables lets say example Table1, Table2, Table3 and I want to create a view which having definition

CREATE VIEW vSample As

SELECT * FROM Table1 UNION ALL SELECT * FROM Table2 UNION ALL SELECT * FROM Table3

Now my question is, I want to show one more column as TableNo which should show 1 i.e. rows from Table1, 2 for rows from table2 and 3 for table3 when I do Select * from vSample.


Viewing all articles
Browse latest Browse all 4729

Trending Articles



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