mysql Merge/Join table results - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: mysql Merge/Join table results (/showthread.php?tid=7240) |
mysql Merge/Join table results - El Forum - 03-31-2008 [eluser]adamp1[/eluser] I want to perform multiple queries on multiple tables which have nothing to do with any other query, and have all the results returned into a single result table. Each query will only ever return a single cell, never multiple columns or rows. Now I could specify each query and run each and get the answers back, but this doesn't expand well and is messy. So I thought about JOINING or MERGING the results. I tried the following Code: SELECT * FROM Now this works but I don't like the fact that the first query is defined differently to the rest. I.E. not using a JOIN. What I want is something like this. Code: (SELECT COUNT(*) AS unactive FROM be_users WHERE active=0) So does anyone know how I can combine these queries and return a result table which has a single row, with the correct column headers. I tried UNION but that looses the column information? Any ideas? |