问题:使用sql查询时报错文章来源:https://www.toymoban.com/news/detail-613254.html
SELECT
*
FROM
(
SELECT
a.value2,
a.value3,
a.value4,
a.hospitalization_id
FROM
v_treatment_process a
WHERE
a.is_del = 0
AND a.value1 = '1'
ORDER BY
a.treatment_items,
a.use_func,
a.is_record,
a.value2,
a.value3 DESC
) d
WHERE
1 = 1
解决办法:在sql子查询SELECT 后加 TOP 100 PERCENT (查询出前百分比为100的数据,也就是查询出全部数据) ,如下文章来源地址https://www.toymoban.com/news/detail-613254.html
SELECT
*
FROM
(
SELECT TOP 100 PERCENT
a.value2,
a.value3,
a.value4,
a.hospitalization_id
FROM
v_treatment_process a
WHERE
a.is_del = 0
AND a.value1 = '1'
ORDER BY
a.treatment_items,
a.use_func,
a.is_record,
a.value2,
a.value3 DESC
) d
WHERE
1 = 1
到了这里,关于sqlserver sql 异常<除非另外还指定了 TOP、OFFSET 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。>的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!