SELECT column1,column2 FROM table1 UNION SELECT column1,column2 FROM table2 |
All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists. |
UserID | UserName | Location |
1 | Suresh | Hyderabad |
2 | Prasanthi | Hyderabad |
3 | Mahesh | Vizag |
UserID | UserName | Location |
1 | Suresh | Hyderabad |
2 | Nagaraju | Bangalore |
3 | Madhav | Nagpur |
SELECT UserName,Location FROM UserInfo UNION SELECT UserName,Location FROM UserDetails |
UserName | Location |
Suresh | Hyderabad |
Prasanthi | Hyderabad |
Mahesh | Vizag |
Nagaraju | Bangalore |
Madhav | Nagpur |
SELECT column1,column2 FROM table1 UNION ALL SELECT column1,column2 FROM table2 |
UserName | Location |
Suresh | Hyderabad |
Suresh | Hyderabad |
Prasanthi | Hyderabad |
Mahesh | Vizag |
Nagaraju | Bangalore |
Madhav | Nagpur |
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
0 comments :