服务器: 消息 170,级别 15,状态 1,行 5 第 5 行: '(' 附近有语法错误。 求解,在线等、
SELECTTOP2*FROMNclassWHEREidNOTIN(SELECTTOP2*(2-1)idFROMNclassORDERBYid)ORDERBYid...
SELECT TOP 2*
FROM Nclass
WHERE id NOT IN
(
SELECT TOP 2* (2-1) id FROM Nclass ORDER BY id
)
ORDER BY id 展开
FROM Nclass
WHERE id NOT IN
(
SELECT TOP 2* (2-1) id FROM Nclass ORDER BY id
)
ORDER BY id 展开
展开全部
TOP 2* (2-1) 应改为 TOP (2 * (2-1)),否则会解释为top 2 * 然後後面又是(2-1)导致语法错误
正确应为
SELECT TOP 2 *
FROM Nclass
WHERE id NOT IN
(
SELECT TOP (2 * (2-1)) id FROM Nclass ORDER BY id
)
ORDER BY id
正确应为
SELECT TOP 2 *
FROM Nclass
WHERE id NOT IN
(
SELECT TOP (2 * (2-1)) id FROM Nclass ORDER BY id
)
ORDER BY id
追问
改了。怎么还是报同样的错误啊。?
追答
我测的没报错啊,不过你为什麼要写成2*(2-1)呢?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询