+ 5

UNION syntax of SQL is'nt working !!😭😭. Why??

I have two tables . 1st named [ Humans ]. 2nd named [ Users ]. This is the syntax I used to get UNION of the table but it is giving number of errors. Select * from Users UNION select * from Humans ; The output is not coming. If coming , not as wanted.. totally different. Please help me out. Exams near.😞😞 I can't make you understand whole here. Please you may refer to the code below. It will make you clear https://code.sololearn.com/WUh1eH5r7QdP/?ref=app

5th Jul 2018, 3:10 PM
OM KASHYAP
OM KASHYAP - avatar
3 ответов
+ 2
union is trying to make a report with 7 fields and 18 data records. sounds like you want 9 records with 9 fields (Id First_Name Last_Name Age Future Salary Hobbies Class Blood_group). Try: SELECT * FROM Humans INNER JOIN Users ON Humans.Id=Users.Id;
6th Jul 2018, 12:49 PM
John Wells
John Wells - avatar
+ 5
John Wells . Tables have Id column which is same in both .. but how there is nothing similar. I don't understand. please can you tell me. I want to do union of two tables so what I would required
6th Jul 2018, 11:07 AM
OM KASHYAP
OM KASHYAP - avatar
+ 4
I have no clue what output you are expecting to get and without an example can't really help you. As far as I can tell, those tables have nothing to do with each other. Their structure is completely different and union requires similar structures.
6th Jul 2018, 12:42 AM
John Wells
John Wells - avatar