Table1 have A, B, C three columns
Suppose that there are data
A B C
A001 B001 C001
A002 B002 C001
A003 B003 C001
Table2 have A, B, C, D, E,
Suppose that there are data
A B C D E
A001 B001 C001... .
A002 B002 C001... .
A004 B004 C001... .
Question: I want to find out two C column in the table='C001' A, B two columns of data, data duplication,
CodePudding user response:
The query results, shown in the form of what?CodePudding user response:
Select a, b from table1 where c='C001' unionSelect a, b from table2 where c='C001'
Is to ask the difference between Union and Union all?
CodePudding user response:
Method one:Select A, B from table1 where C='C001'
The union
Select A, B from table2 where C='C001'
Method 2:
Select
Distinct - remove duplicates
*
The from (
Select A, B from table1 where C='C001'
Union all
Select A, B from table2 where C='C001')
CodePudding user response:
Positive solution, upstairs floor pig is doing?