我想
我正在使用的代码是
SELECT TOP (10) *
FROM (
SELECT DISTINCT(business_id) FROM businessdata
WHERE businessdata.city = 'Phoenix'
)
;
我得到的错误是
Msg 102, Level 15, State 1, Line 7
Incorrect syntax near ';'.
我要去哪里错了?
答案 0 :(得分:0)
您必须给子查询命名:
SELECT TOP (10) *
FROM (
SELECT DISTINCT(business_id) FROM businessdata
WHERE businessdata.city = 'Phoenix'
) AS my_subquery
ORDER BY businessdata
;
确保您还可以通过ORDER BY正确设置订单,从而使TOP有意义