posts - 15,  comments - 4,  trackbacks - 0

//子查询
select * from site_product
where productid > '286585' 
and state = '1' 
and siteid <> '750473' 
and image <> ''  
and siteid in (SELECT siteid from site_company WHERE state=1)
order by  productid desc 
LIMIT 1 offset 0;


//左联查询
select * from (select companyid as tt from base_companymember order by random() Limit "+num+") as a LEFT JOIN base_company ON tt=companyid

//上一个, 下一个
select mediaid,medianame,filepath 
FROM (SELECT row_number() OVER (ORDER BY displayorder DESC,mediaid desc)as rowno,mediaid,medianame,displayorder,filepath FROM site_media WHERE state>=0 and siteid=3854719) as aaa
WHERE
aaa.rowno>(SELECT rowno FROM (SELECT row_number() OVER (ORDER BY displayorder DESC,mediaid desc)as rowno,mediaid,medianame,displayorder,filepath FROM site_media WHERE state>=0 and siteid=3854719) as bbb WHERE bbb.mediaid=899)
ORDER BY aaa.rowno 
LIMIT 1;

posted on 2012-11-02 15:28 老天 阅读(137) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 
<2012年11月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

常用链接

留言簿

随笔档案

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜