I try to multiple select in MySql but it doesn’t work.
Example :
SELECT (SELECT column1, column2 FROM table1 WHERE column3='something') AS query1,
(SELECT column4 FROM table1 WHERE column4='something') AS query2
And the result i try to have is something similar to this :
[{query1}, {query2 : [...]}]
query1 always will have only 1 row but query2 can will have multiple row
Can someone help me please ?
2
Answers
Maybe try this way:
WITH query 1 AS (Select …..),
query 2 AS (select …),
query3 AS ( SELECT * FROM query 1
UNION ALL
SELECT * FROM query 2)
SELECT * FROM query3
Is this what you mean ? Join column wise?
And CTE to combine columns: