This is a discussion on Union and Union All within the Database Support forums, part of the Web Development category; Hi all... Can we discuss briefly about the Union and Union All in sql. Thanks in advance......
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all... Union : The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. Syntax: select * from table1_name union select * from table2_name Union All: The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values. Syntax: select * from table1_name union all select * from table2_name Thanks... |
| |||
| Hi vinoth, Could you please suggest me which one is good method in the following condition. Assume that this table contains more than 1 lakh records. 1. Using UNION (same table) select * from employee where age=25 union select * from employee where age=26 2. Using OR (same table) select * from employee where age=25 or age=26
__________________ Keep smiling... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Make out of Structure and Union | velhari | C and C++ Programming | 2 | 04-03-2008 03:55 AM |
| UNION ALL faster than a UNION? | vadivelanvaidyanathan | Database Support | 4 | 08-18-2007 02:04 AM |
| What is the difference between UNION and UNIONALL in SQL Server? | bluesky | Database Support | 1 | 07-25-2007 05:53 AM |
| what is the UNION in c++? with Example | sundarraja | C and C++ Programming | 1 | 07-20-2007 07:44 AM |
| What's the difference between a structure and a union | prasath | C and C++ Programming | 1 | 07-18-2007 05:14 AM |