mysql> select job_desc_title from postings where id=194582;
+-----------------------------+ | job_desc_title | +-----------------------------+ | Speech/Language Pathologist | +-----------------------------+ 1 row in set (0.00 sec)
mysql> select email_address,first_name,last_name,home_phone_area,home_phone_num from accounts
-> left join profiles on profiles.account_id=accounts.id
-> where accounts.id=5;
+--------------------+------------+-----------+-----------------+----------------+ | email_address | first_name | last_name | home_phone_area | home_phone_num | +--------------------+------------+-----------+-----------------+----------------+ | [email protected] | Jianhua | He | 425 | 3584396 | +--------------------+------------+-----------+-----------------+----------------+ 1 row in set (0.00 sec)
I need to union the above 2 queries,but my trial failed:
mysql> select job_desc_title from postings where id=194582
-> union all
-> select email_address,first_name,last_name,home_phone_area,home_phone_num from accounts
-> left join profiles on profiles.account_id=accounts.id
-> where accounts.id=5;
ERROR 1222 (21000): The used SELECT statements have a different number of columns
What's the right version to do this job?