gpt4 book ai didi

SQL 获取 10 个最大的数字

转载 作者:行者123 更新时间:2023-12-03 01:03:44 30 4
gpt4 key购买 nike

我正在尝试从名为 Bonus 的表中检索 10 个最大的数字。

但我收到此错误消息:

Incorrect syntax near 'LIMIT'

我的代码:

SELECT cust_nr, period1_bonus FROM bonus ORDER BY period1_bonus DESC LIMIT 10

最佳答案

试试这个:

SELECT TOP 10 cust_nr, period1_bonus FROM bonus ORDER BY period1_bonus DESC

LIMIT <x>是 mySQL 构造,而不是 MSSQL 构造。 TOP应该在这里为你工作。

关于SQL 获取 10 个最大的数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5898428/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com