SQL Query with LEFT JOIN Issue

前端 未结 2 1712
Happy的楠姐
Happy的楠姐 2021-01-24 05:45

I am having problems with a left join SQL query but can\'t see why it isn\'t working. I have 3 tables: customers, purchases and payments, and i\'m trying to select customers who

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-24 06:32

    Unfortunately you can't reference an alias on the same "level" where it's defined.

    You need to wrap everything into a derived table:

    select *
    from (
       
    ) t
    where balance > 0
    

提交回复
热议问题