UNION ALL just doesn't work here :( why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

UNION ALL just doesn't work here :( why?

plz see these PICs: "first" and "second" tables I'm supposed to have are given by: https://app.box.com/s/5a95bbb3hmquwrk4b7b7dzi1evz34loi I created these same exact tables: https://app.box.com/s/5a95bbb3hmquwrk4b7b7dzi1evz34loi https://app.box.com/s/2p01nzzht9i6jjzhf2dyvjk8nmsmcorb Now, the SQL query itself I do is: https://app.box.com/s/6n69eka4yu7tnijiazayk292hkm7iplf [Oh, and BTW, hovering my mouse over that cross in the red circle on the left of the middle line just tells me: Unrecognized statement type. (near ALL)] Running my SQL query then gives: https://app.box.com/s/u2ic9nph6wunilhiq6jsd9mwlbz4ke6s which sadly fails to match what they got: https://app.box.com/s/h9a5ot7goj8tdef6h7zt05pxf9y98mm5 just can't see where exactly I'm going wrong - why???!! :((( Big thanks! :)

30th Jun 2016, 10:50 AM
Krishna Limani
Krishna Limani - avatar
2 Answers
+ 2
Try putting the table name first in square brackets like so [first]. Some names are reserved for keywords and will throw an error if they are not enclosed in the brackets. Edit : square brackets is used for ms sql server, I realised later that you appear to be using mysql which uses quotation marks I think
30th Jun 2016, 11:34 AM
Erick
Erick - avatar
0
WOW, OMG!!! I first tried round brackets, so like (first) and (second). This worked PERFECTLY :). HOWEVER, square brackets, as u suggested, had failed awkwardly. Why these 2 observations?
30th Jun 2016, 11:41 AM
Krishna Limani
Krishna Limani - avatar