Skip to content
Advertisement

Want to concatenate column of the second query to the first query but getting errors such as “query block has incorrect number of result columns”

Here Roll_No is a user inserted data so for now I have hard coded it. Basically with the help of ROLL_NO I sort the STUDENTS_INFO table from where I get the ID and based on that I try to get PRIM_EMAIL, SEC_EMAIL, PHONE from the STUDENTS.RECORDS table while matching the foreign keys of both the tables. In addition to the current result set I also want to have the prov_name column.

Any help is very much appreciated. Thank you!

Advertisement

Answer

I suspect that you want to put all this information on the same row, which suggests a join rather than union all:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement