SELECT *
FROM Under_200 u
WHERE u.Chance_of_Gain_under > 75;
SELECT *
FROM Over_200 o
WHERE o.Chance_of_Gain_over > 75;
I am trying to join two separate MySQL queries in a horizontal fashion. Such as a Pandas concat where the axis = 1.
CodePudding user response:
If Symbol is the column denominator , you can use bith queries as subqueries
SELECT u.*,o.*
FROM
(SELECT *
FROM Under_200
WHERE Chance_of_Gain_under > 75) u
JOIN
(
SELECT *
FROM Over_200
WHERE Chance_of_Gain_over > 75) o ON o.Symbol = u.Symbol
CodePudding user response:
WITH custom_tab1
AS (SELECT *
FROM under_200
WHERE chance_of_gain_under > 75),
custom_tab2
AS (SELECT *
FROM over_200
WHERE chance_of_gain_over > 75)
SELECT *
FROM custom_tab1 ct1
INNER JOIN custom_tab2 ct2
ON ct1.symbol = ct2.symbol;
Check if this works. I have solved using a common table expression.