|
登录后查才能浏览下载更多咨询,有问题联系QQ:3283999
您需要 登录 才可以下载或查看,没有账号?入住遨海湾
×
1、调用含有图片的日志 SELECT * FROM `uchome_blog` WHERE `picflag` =1; 4 e4 X7 W) E% s A8 u
2、调用最近更新的10条日志 SELECT * FROM uchome_blog FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
! d6 }! b* M. I: w$ i) w+ s, _3、调用最近更新的10个相册 SELECT * FROM uchome_album FORCE INDEX(updatetime) ORDER BY dateline DESC LIMIT 0,10;
% m& c, K( d) F! b说明:这是调用所有相册4 t* f, v' O9 s* b
加个条件:调用隐私设计为全站可见的相册 SELECT * FROM uchome_album FORCE INDEX(updatetime) WHERE `friend` =0 ORDER BY dateline DESC
D# G+ ^: h+ `, I" M V K6 D说明:friend值: '0'全站用户可见,'1'为全好友可见,'2'为仅指定的好友可见,'3'为仅自己可见,'4'为凭密码查看9 r" N) I: M3 E5 W) q c# t
" ]3 J3 n" t" _' t/ a8 K4、调用最近的10条播客 SELECT * FROM uchome_doing FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
+ x) z% i$ Q u/ g3 E' z5、调用我的话题 SELECT * FROM uchome_thread ORDER BY dateline DESC LIMIT 0,10;
+ W, |2 T- o2 E# s/ r; I6、调用3天内回复数最多的日志 SELECT * FROM uchome_blog WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY replynum DESC
6 Z& e' B" Y3 @* X" x" o7、调用选吧一周内的热点话题 select * FROM uchome_thread where dateline>=UNIX_TIMESTAMP()-604800 ORDER BY viewnum DESC; ! H* j" @7 R+ y; p, \, K6 {" C
或者 SELECT * FROM uchome_ thread WHERE dateline>=UNIX_TIMESTAMP()-86400*7 ORDER BY viewnum DESC;
; ]1 `: R% a1 t0 P2 Z8、调用最近3天注册的人,且按照降序排列 SELECT * FROM uchome_space WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY dateline DESC; + H1 v) ^ @5 T5 W- a1 d; |
9、调用最后更新的10位会员 select * from uchome_space order by updatetime desc LIMIT 0,10; 8 h8 b! I3 n+ c# @
10、将用户栏目的内容列表出来,并以用户积分作为排列顺序 SELECT * FROM uchome_spacefield sf, uchome_space s WHERE s.uid=sf.uid order by s.credit desc |. J3 W1 m1 ]$ S5 ]% A9 k
说明:field_1为 uchome_spacefield 这个表要调用的用户栏目选择项,可以为field_1,field_2。。。6 m1 P6 J& [, a0 @6 i
11、调用个人空间性别为女的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=2
" |* _, @0 }" o" i12、调用个人空间性别为男的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=1
. v3 K9 M' ]* E \/ b& p# T# r13、调用积分高的前10个会员 select * from uchome_space order by credit desc LIMIT 0,10;
# K. G$ a" o d6 x; \8 T14、调用访问量最大的空间 select * from uchome_space order by viewnum desc LIMIT 0,10; ) u5 B. b& q! k, Z
15、调用指定用户的日志 SELECT * FROM `uchome_blog` WHERE uid =1 LIMIT 0 , 10
2 u& `' P6 `# L: g这是调用uid为1的10条记录
5 x8 j- e/ z7 s' b1 u16、调用有头像的10个会员 SELECT * FROM `uchome_space` WHERE `avatar` =1 LIMIT 0 , 10 8 j1 E7 G( y+ M' k0 c( {; ~$ Y+ S
17、调用某一主题回复的内容 SELECT * FROM `uchome_post` WHERE tid =1 AND isthread =0 LIMIT 0 , 30; 7 O, D6 g* Y! c( _6 b3 h; L* w
上面的SQL语,可以调用主题id为1的30条回复1 w# C/ w7 W3 e/ R# W/ P3 f
18、调用群组 SELECT * FROM `uchome_mtag` LIMIT 0 , 10
$ c% b) Q9 A; ], J# V3 A8 l9 y/ ^19、调用一周热门会员 select * from uchome_space WHERE dateline>=UNIX_TIMESTAMP(). i8 A9 D' J. S/ D4 G/ G
. l& I I9 }: |-3600*24*7 ORDER BY viewnum DESC LIMIT 0,18
2 q1 \0 e, `+ z ~! U20、调用发过帖子且有头像的会员 SELECT * from uchome_blog s,uchome_space sf where s.uid=sf.uid and sf.avatar=1 |
|