1

what's wrong with this code, both sub select statement work well but full join give me error

select t1.*, t2.*
from (
    SELECT
        `users-transaction`.`users-transaction-id` as 'id-1',
     concat(`users-transaction`.`users-transaction-year`+ `users-transaction`.`users-transaction-month`+ `users-transaction`.`users-transaction-day`) as date1,
        sum(`users-transaction`.`users-transaction-price`) as gharzi
    FROM `users-transaction` 
    where  `users-transaction`.`users-transaction-type`=0 
        GROUP BY `users-transaction-year`, `users-transaction-month`, `users-transaction-day`
    ) t1
    full outer JOIN
   (

    SELECT  
        `users-transaction`.`users-transaction-id` as 'id-2',
     concat(`users-transaction`.`users-transaction-year`+ `users-transaction`.`users-transaction-month`+ `users-transaction`.`users-transaction-day`) as date2,
        sum(`users-transaction`.`users-transaction-price`) as pardakhti
    FROM `users-transaction` 
    where  `users-transaction`.`users-transaction-type`=1 
        GROUP BY `users-transaction-year`, `users-transaction-month`, `users-transaction-day`
    ) t2 on t1.date1=t2.date2

Table structure:

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
Buddha
  • 13
  • 4

0 Answers0