Table name from Subquery [SQL]
I was looking for the column "age" from table B, but when I used "b.age", it resulted in an error. Error code SELECT a.cuisine_type, a.price, 할인률, b,age, a.price-(price*할인률) 'after_discount' FROM ( SELECT a.cuisine_type, a.price, b.age, if(b.age>50,(b.age-50)*0.005,0) '할인률' from food_orders a left join customers b on a.customer_id=b.customer_id ) a order by 할인률 desc The error occurred because th..
2024. 3. 21.
Red highlighted error [SQL]
I received an error message, but the result is fine. I can't find any issues, but the SQL system highlighted the word. SELECT a.cuisine_type, a.price, discount, age, a.price-(price*discount) 'after_discount' FROM ( SELECT a.cuisine_type, a.price, b.age, if(b.age>50,(b.age-50)*0.005,0) 'discount' from food_orders a left join customers b on a.customer_id=b.customer_id ) a order by discount desc
2024. 3. 21.