在Bigquery Sandbox中,预期输入结束,但却得到了关键字ORDER。

huangapple go评论82阅读模式
英文:

Expected end of input but got keyword ORDER in Bigquery Sandbox?

问题

当我执行

SELECT
purchase_price
FROM
my-project-a-392201.customer_data2.customer_purchase LIMIT 1000
ORDER BY
purchase_price DESC


我得到

>语法错误:预期输入的结束但在[5:1]处得到关键字ORDER

为什么会发生这种情况?
英文:

When I execute

SELECT 
purchase_price 
FROM 
`my-project-a-392201.customer_data2.customer_purchase` LIMIT 1000
ORDER BY
purchase_price DESC

I get

>Syntax error: Expected end of input but got keyword ORDER at [5:1]

Why is this happening?

答案1

得分: 1

正确的语法是在“ORDER BY”之后使用“LIMIT”。

SELECT purchase_price 
FROM my-project-a-392201.customer_data2.customer_purchase 
ORDER BY purchase_price DESC
LIMIT 1000;
英文:

The correct syntax has Limit following Order By

SELECT purchase_price 
FROM my-project-a-392201.customer_data2.customer_purchase 
ORDER BY purchase_price DESC
LIMIT 1000;

huangapple
  • 本文由 发表于 2023年7月14日 03:35:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76682705.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定