导航
  • 主页
  • 基础类
  • 应用实例
  • 新技术前沿

大家帮我看看这段代码哪错了呀?

97℃空间 2007-12-11 10:42:07
SELECT TOP 5 y.ClassEName,y.savefilepath, j.FileName, j.Title,j.headnewspath, j.AddDate,j.PicPath FROM [FS_NewsClass ] AS y LEFT JOIN [FS_News ] AS j ON y.ClassID = j.ClassID WHERE (y.ParentID in (0612271615431277,06122716311997437) and j.picNewsTF=1 order by j.adddate desc
...全文
25 点赞 收藏 7
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
fwacky 2007-12-11

where 后面多一个 “(”

回复
fa_ge 2007-12-11


SELECT TOP 5
y.ClassEName,y.savefilepath,
j.FileName, j.Title,j.headnewspath,
j.AddDate,j.PicPath
FROM [FS_NewsClass] AS y LEFT JOIN [FS_News ] AS j
ON y.ClassID = j.ClassID
WHERE y.ParentID in (0612271615431277,06122716311997437) --在这多了个'('
and j.picNewsTF=1
order by j.adddate desc

--还有一点 y.ParentID 是字符型的话,后面的值加上单引号
回复
fwacky 2007-12-11

try
=======================
SELECT TOP 5
y.ClassEName,
y.savefilepath,
j.FileName,
j.Title,j.headnewspath,
j.AddDate,
j.PicPath
FROM FS_NewsClass y LEFT JOIN FS_News j
ON y.ClassID = j.ClassID
WHERE
y.ParentID in ('0612271615431277','06122716311997437')
and j.picNewsTF = 1
order by j.adddate desc



in() 要用 for example : in ('2145','454554')
回复
pt1314917 2007-12-11

SELECT TOP 5 y.ClassEName,y.savefilepath,j.FileName, j.Title,j.headnewspath, j.AddDate,j.PicPath
FROM FS_NewsClass y
LEFT JOIN FS_News j
ON y.ClassID = j.ClassID
WHERE y.ParentID in ('0612271615431277','06122716311997437')
and j.picNewsTF=1 order by j.adddate desc
回复
wzy_love_sly 2007-12-11
加括号不行
回复
wzy_love_sly 2007-12-11
WHERE y.ParentID in (0612271615431277,06122716311997437 and j.picNewsTF=1 order by j.adddate desc
回复
fwacky 2007-12-11

SELECT TOP 5 y.ClassEName,y.savefilepath, j.FileName, j.Title,j.headnewspath, j.AddDate,j.PicPath
FROM [FS_NewsClass ] y LEFT JOIN [FS_News ] j ON y.ClassID = j.ClassID
WHERE (y.ParentID in (0612271615431277,06122716311997437) and j.picNewsTF=1 order by j.adddate desc

表名 不用 as
回复
发动态
发帖子
MS-SQL Server
创建于2007-09-28

3.2w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
社区公告
暂无公告