Skip to content
Advertisement

How to query in sql with duplicate records?

Hi i have ITEAM A and ITEAM B table. For example

 Table 1)     ITEAM A

ID   DATA
1    J
2    C
3    P

Table 2) ITEAM B

ID   DATA
1    C
2    P
3    J
4    R

Expected Result

Result:
C
C
J
J
P
P
R

How to fetch records combined ITEAM A and ITEAM B with ascending order and duplicate records in sql? please help someone

Advertisement

Answer

SELECT data FROM tableA
UNION ALL
SELECT data FROM tableB
ORDER BY data
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement