为什么我在现场列表中获得未知列?
运行此命令时,我在“字段列表”中获取未知列“订单”
我正在尝试获取带有订单数量的客户列表,以及用于类型的新列。如果客户有10个以上的订单。这是一个大买家等。
SELECT
customerTable.isActive,
(SELECT
COUNT(*)
FROM
orderTable
WHERE
orderTable.customerId = customerTable.id) AS Orders,
CASE
WHEN Orders > 10 THEN 'Big buyer'
WHEN Orders > 12 THEN 'Biggest buyer'
END AS 'Type'
FROM customerTable
当您在查询的“列”部分中使用SELECT时,正确的术语是什么?
When I run this command, I get the Unknown column 'Orders' in 'field list'
I am trying to get customer list with number of orders, and a new column for type. If the customer has more than 10 orders. It is a big buyer etc.
SELECT
customerTable.isActive,
(SELECT
COUNT(*)
FROM
orderTable
WHERE
orderTable.customerId = customerTable.id) AS Orders,
CASE
WHEN Orders > 10 THEN 'Big buyer'
WHEN Orders > 12 THEN 'Biggest buyer'
END AS 'Type'
FROM customerTable
Also what is the correct term when you use select in the column section of my query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这对您有用。
在“列列表中”中的选择
仅被视为一个子查询。I think this will work for you.
The
SELECT
in the column list is just considered a subquery.