discuz如何在diy內(nèi)進(jìn)行寫sql語句調(diào)用


推選答案幫你搜了下,不知道對(duì)你有幫助沒1、調(diào)用含有圖片的日志 SELECt * FROM `uchome_blog` WHERe `picflag` =1;

2、調(diào)用最近更新的10條日志 SELECt * FROM uchome_blog FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;

3、調(diào)用最近更新的10個(gè)相冊(cè) SELECt * FROM uchome_album FORCE INDEX(updatetime) ORDER BY dateline DESC LIMIT 0,10;

說明:這是調(diào)用所有相冊(cè)

加個(gè)條件:調(diào)用隱私設(shè)計(jì)為全站可見的相冊(cè) SELECT * FROM uchome_album FORCE INDEX(updatetime) WHERe `friend` =0 ORDER BY dateline DESC

說明:friend值: '0'全站用戶可見,'1'為全好友可見,'2'為僅指定的好友可見,'3'為僅自己可見,'4'為憑密碼查看

4、調(diào)用最近的10條迷你博客 SELECT * FROM uchome_doing FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
discuz如何在diy內(nèi)進(jìn)行寫sql語句調(diào)用


5、調(diào)用我的話題 SELECt * FROM uchome_thread ORDER BY dateline DESC LIMIT 0,10;

6、調(diào)用3天內(nèi)回復(fù)數(shù)最多的日志 SELECt * FROM uchome_blog WHERe dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY replynum DESC

7、調(diào)用選吧一周內(nèi)的熱點(diǎn)話題 select * FROM uchome_thread where dateline>=UNIX_TIMESTAMP()-604800 ORDER BY viewnum DESC;

或者 SELECt * FROM uchome_ thread WHERe dateline>=UNIX_TIMESTAMP()-86400*7 ORDER BY viewnum DESC;

8、調(diào)用最近3天注冊(cè)的人,且按照降序排列 SELECt * FROM uchome_space WHERe dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY dateline DESC;

9、調(diào)用最后更新的10位會(huì)員 select * from uchome_space order by updatetime desc LIMIT 0,10;

10、將用戶欄目的內(nèi)容列表出來,并以用戶積分作為排列順序 SELECT * FROM uchome_spacefield sf, uchome_space s WHERe s.uid=sf.uid order by s.credit desc
discuz如何在diy內(nèi)進(jìn)行寫sql語句調(diào)用


說明:field_1為 uchome_spacefield 這個(gè)表要調(diào)用的用戶欄目選擇項(xiàng),可以為field_1,field_2。。。

11、調(diào)用個(gè)人空間性別為女的用戶 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=2

12、調(diào)用個(gè)人空間性別為男的用戶 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=1

13、調(diào)用積分高的前10個(gè)會(huì)員 select * from uchome_space order by credit desc LIMIT 0,10;

14、調(diào)用訪問量最大的空間 select * from uchome_space order by viewnum desc LIMIT 0,10;

15、調(diào)用指定用戶的日志 SELECt * FROM `uchome_blog` WHERe uid =1 LIMIT 0 , 10

這是調(diào)用uid為1的10條記錄

16、調(diào)用有頭像的10個(gè)會(huì)員 SELECt * FROM `uchome_space` WHERe `avatar` =1 LIMIT 0 , 10

17、調(diào)用某一主題回復(fù)的內(nèi)容 SELECt * FROM `uchome_post` WHERe tid =1 AND isthread =0 LIMIT 0 , 30;
discuz如何在diy內(nèi)進(jìn)行寫sql語句調(diào)用


上面的SQL語,可以調(diào)用主題id為1的30條回復(fù)

18、調(diào)用群組 SELECt * FROM `uchome_mtag` LIMIT 0 , 10

19、調(diào)用一周熱門會(huì)員 select * from uchome_space WHERe dateline>=UNIX_TIMESTAMP() -3600*24*7 ORDER BY viewnum DESC LIMIT 0,18

20、調(diào)用發(fā)過帖子且有頭像的會(huì)員 SELECt * from uchome_blog s,uchome_space sf where s.uid=sf.uid and sf.avatar=1

21、調(diào)用最熱的群組 select * from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid and ORDER BY sf.membernum DESC LIMIT 0,10;

22、調(diào)用有圖片的5個(gè)相冊(cè) SELECt * FROM `uchome_album` WHERe picflag =1 LIMIT 0 , 30

23、調(diào)用競(jìng)價(jià)排行 SELECt * FROM `uchome_show` ORDER BY credit DESC LIMIT 0,10;

24、調(diào)用最新上傳的10張圖片 SELECt * FROM `uchome_pic`order by dateline desc LIMIT 0,10;

25、調(diào)用有話題的群組 select * from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid LIMIT 0 , 10

26、調(diào)用最新的10個(gè)群組 SELECt * FROM `uchome_mtag`ORDER BY tagid DESC LIMIT 0,10;

27、調(diào)用群主id為1的有頭像的10個(gè)會(huì)員 SELECt * from uchome_tagspace s,uchome_space sf where s.uid=sf.uid and sf.avatar=1 AND s.tagid=1 ORDER BY sf.dateline DESC LIMIT 0,10;

28、調(diào)用單身的用戶 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.marry=1

29、調(diào)用實(shí)名認(rèn)證用戶 select * from uchome_space where `name`!=''

30、調(diào)用話題標(biāo)題和所屬群組名稱 select * from uchome_mtag s,uchome_thread sf where s.tagid=sf.tagid ORDER BY sf.dateline DESC LIMIT 0,10;

31、隨機(jī)調(diào)用用戶的頭像和用戶名 SELECt * FROM `uchome_space` AS `space` LEFT JOIN `uchome_spacefield` AS `spacefield` on `space`.`uid`=`spacefield`.`uid` WHERe `space`.`avatar`='1' ORDER BY RAND()

32、調(diào)用指定群組的最新話題 select s.*,sf.* from uchome_post s,uchome_mtag sf where s.tagid=sf.tagid and sf.tagid=1 ORDER BY s.dateline LIMIT 0 , 10
網(wǎng)上報(bào)名
  • 姓名:
  • 專業(yè):
  • 層次: ??分?jǐn)?shù):
  • 電話:
  • QQ/微信:
  • 地址:

文中圖片素材來源網(wǎng)絡(luò),如有侵權(quán)請(qǐng)聯(lián)系644062549@qq.com刪除

轉(zhuǎn)載注明出處:http://www.haoleitv.com