Hello everyone. Is there no way of changing the ID column of the tables that have been joined using UNION to be unique | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hello everyone. Is there no way of changing the ID column of the tables that have been joined using UNION to be unique

What I mean here is, instead of having 1,2,3,1,2,3 as the ID of the resulting table, you convert it to 1,2,3,4,5,6 and so on.....using a line of code.

16th Jun 2019, 1:14 PM
Ebugo_
Ebugo_ - avatar
4 Answers
+ 2
SELECT DISTINCT id FROM table1, table2 WHERE condition ORDER BY id ASC;
16th Jun 2019, 4:36 PM
Jackson O’Donnell
+ 1
Any more ways I can do this pls?
17th Jun 2019, 8:08 AM
Ebugo_
Ebugo_ - avatar
0
INSERT INTO Employees (ID, FirstName, LastName) VALUES (5, 'john', 'philip'); please try this syntax
3rd Jul 2019, 3:07 PM
John Philip
John Philip - avatar
0
This will give you a new row
3rd Jul 2019, 3:20 PM
Ebugo_
Ebugo_ - avatar