- 最后登录
- 2013-11-17
- 在线时间
- 24 小时
- 威望
- 53
- 金钱
- 364
- 注册时间
- 2012-3-14
- 阅读权限
- 50
- 帖子
- 37
- 精华
- 0
- 积分
- 53
- UID
- 297
|
23#
发表于 2012-5-11 12:21:59
- select rowid,
- title,
- filepath,
- filename,
- layoutpath,
- publishdate,
- classid,
- infolink,
- defaultpicurl,
- hits
- FROM (SELECT t.Title as title,
- t.FilePath as filepath,
- t.FileName as filename,
- t.LayOutPath as layoutpath,
- t.PublishDate as publishdate,
- t.ClassID as classid,
- t.InfoLink as infolink,
- t.DefaultPicUrl as defaultpicurl,
- t.Hits as hits
- row_number() over(order by t.ArticleID desc) rn
- FROM Article t
- WHERE t.articleid in (SELECT a.ArticleID
- FROM Article a, ArticleKeyWord k
- WHERE a.Deleted = 0
- AND a.Passed = 1
- AND a.ToHtml = 1
- AND a.ArticleID != 1241637
- AND t.ArticleID = a.ArticleID
- AND a.InfoShareType = 0
- AND a.ArticleID = k.INFOID
- AND k.KeyWord in('A','B','C','D','E','F','G','H','I','J'))
- AND t.SiteID = 202
- AND t.cssType = 'none')
- WHERE rn <= 5;
复制代码
试试这个呢?还有一种写法将最里面的子查询拿到和article进行关联查询。 |
|