我一直试图弄清楚如何使用此查询执行列别名,但我似乎无法得到它。
SELECT (customer.customer_id) as ID, (CUSTOMER.FIRST_NAME, CUSTOMER.LAST_NAME) as name, (customer.address,customer.town,customer.post_code) as address, LOYALTY_CARD.POINTS
FROM LOYALTY_CARD
INNER JOIN CUSTOMER
ON LOYALTY_CARD.CUSTOMER_ID = CUSTOMER.CUSTOMER_ID WHERE LOYALTY_CARD.POINTS > 70 ORDER BY LOYALTY_CARD.POINTS
我收到的错误是operand should contain 1 column
答案 0 :(得分:1)
(CUSTOMER.FIRST_NAME, CUSTOMER.LAST_NAME) as name
错了。如果你想要将它们组合起来,你需要将它们连接起来。
concat(customer.first_name, ' ', customer.last_name) as name
(customer.address,customer.town,customer.post_code) as address
concat(customer.address, ' ', customer.town, ' ', customer.post_code) as address