I have a required table like
+--------+----------+-----------------+--------------------+-------------------+
|offer_id|Offer_name|Total_offers_sold|total_device_changed|total_offer_changed|
+--------+----------+-----------------+--------------------+-------------------+
now, For first three columns I have found the data using joins and then grouping by offer ID
+--------+----------+-----------------+
|offer_id|Offer_name|Total_offers_sold|
+--------+----------+-----------------+
|12 |abc |23 |
+--------+----------+-----------------+
|23 |gdf |3 |
+--------+----------+-----------------+
|54 |df |54 |
+--------+----------+-----------------+
|56 |gf |4 |
+--------+----------+-----------------+
|65 |ad |17 |
+--------+----------+-----------------+
|75 |hg |54 |
+--------+----------+-----------------+
For other two columns i.e. offer_changed and total_device_changed, they are themselves complex queries to find the required data. lets, say I have this sample data found by executing query for those two clumns.
+--------+-------------------+
|offer_id|total_offer_changed|
+--------+-------------------+
|12 |3 |
+--------+-------------------+
|56 |65 |
+--------+-------------------+
|65 |4 |
+--------+-------------------+
similarly,
+--------+--------------------+
|offer_id|total_device_changed|
+--------+--------------------+
|12 |2 |
+--------+--------------------+
|23 |5 |
+--------+--------------------+
|75 |20 |
+--------+--------------------+
Now the problem is, these are temporary results and I am unable to understand how to merge the results of this output(tables) in the bigger query corresponding to their offer ID's.i.e the final result I need is :
+--------+----------+-----------------+--------------------+-------------------+
|offer_id|Offer_name|Total_offers_sold|total_device_changed|total_offer_changed|
+--------+----------+-----------------+--------------------+-------------------+
|12 |abc |23 |2 |3 |
+--------+----------+-----------------+--------------------+-------------------+
|23 |gdf |3 |5 | |
+--------+----------+-----------------+--------------------+-------------------+
|54 |df |54 | | |
+--------+----------+-----------------+--------------------+-------------------+
|56 |gf |4 | |65 |
+--------+----------+-----------------+--------------------+-------------------+
|65 |ad |17 | |04 |
+--------+----------+-----------------+--------------------+-------------------+
|75 |hg |54 |20 | |
+--------+----------+-----------------+--------------------+-------------------+
please help