|
登录后查才能浏览下载更多咨询,有问题联系QQ:3283999
您需要 登录 才可以下载或查看,没有账号?入住遨海湾
×
1、调用含有图片的日志 SELECT * FROM `uchome_blog` WHERE `picflag` =1;
- q6 W2 ~# ]# f* I7 d" n2、调用最近更新的10条日志 SELECT * FROM uchome_blog FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10; ) x! T, I2 ^! f& q" @
3、调用最近更新的10个相册 SELECT * FROM uchome_album FORCE INDEX(updatetime) ORDER BY dateline DESC LIMIT 0,10;
5 a9 l' a. z6 s ~5 n4 m, x; S说明:这是调用所有相册
% P/ O' e/ @8 o: }' y5 f加个条件:调用隐私设计为全站可见的相册 SELECT * FROM uchome_album FORCE INDEX(updatetime) WHERE `friend` =0 ORDER BY dateline DESC
' i5 \0 y; O+ \3 T4 X& R说明:friend值: '0'全站用户可见,'1'为全好友可见,'2'为仅指定的好友可见,'3'为仅自己可见,'4'为凭密码查看9 g; e0 Z* A+ q; I. C$ k, t/ j
/ E j( Y' q* i0 f3 ^7 I
4、调用最近的10条播客 SELECT * FROM uchome_doing FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
# x/ K; k1 l7 Q4 z+ B" R2 U# ^5、调用我的话题 SELECT * FROM uchome_thread ORDER BY dateline DESC LIMIT 0,10;
0 i$ l5 N" P1 g% n6、调用3天内回复数最多的日志 SELECT * FROM uchome_blog WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY replynum DESC 4 A1 P q. w5 u* R7 Q
7、调用选吧一周内的热点话题 select * FROM uchome_thread where dateline>=UNIX_TIMESTAMP()-604800 ORDER BY viewnum DESC;
8 C4 z) N4 S0 ?+ V; T9 E+ b或者 SELECT * FROM uchome_ thread WHERE dateline>=UNIX_TIMESTAMP()-86400*7 ORDER BY viewnum DESC; # A, H* q2 e" |5 S- I/ \
8、调用最近3天注册的人,且按照降序排列 SELECT * FROM uchome_space WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY dateline DESC;
( X, ]! q7 o# L5 r, f9、调用最后更新的10位会员 select * from uchome_space order by updatetime desc LIMIT 0,10;
8 i( i7 R' F" _, b3 b' [) Y10、将用户栏目的内容列表出来,并以用户积分作为排列顺序 SELECT * FROM uchome_spacefield sf, uchome_space s WHERE s.uid=sf.uid order by s.credit desc ( U0 B- }4 a. R/ N( e
说明:field_1为 uchome_spacefield 这个表要调用的用户栏目选择项,可以为field_1,field_2。。。6 t1 ?5 O& ?/ |& r1 @+ w
11、调用个人空间性别为女的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=2
2 Y' y8 H+ t2 l' n3 o12、调用个人空间性别为男的用户 select * from uchome_space s,uchome_spacefield sf where s.uid=sf.uid and sf.sex=1
6 O( G C/ n' r W13、调用积分高的前10个会员 select * from uchome_space order by credit desc LIMIT 0,10; & e9 l5 d7 k1 Z0 R+ q& v! m e
14、调用访问量最大的空间 select * from uchome_space order by viewnum desc LIMIT 0,10; 6 m% i0 x: Y& Q- L) ^6 b
15、调用指定用户的日志 SELECT * FROM `uchome_blog` WHERE uid =1 LIMIT 0 , 10
9 S+ k7 h, r8 L' v2 y* Z这是调用uid为1的10条记录/ ~- |: r# \( f
16、调用有头像的10个会员 SELECT * FROM `uchome_space` WHERE `avatar` =1 LIMIT 0 , 10 3 P+ i2 J3 ^# x- h% b
17、调用某一主题回复的内容 SELECT * FROM `uchome_post` WHERE tid =1 AND isthread =0 LIMIT 0 , 30;
( T; `$ V0 x' t0 D: m |. P' N2 J上面的SQL语,可以调用主题id为1的30条回复
- X6 F* \( v3 `# V- j18、调用群组 SELECT * FROM `uchome_mtag` LIMIT 0 , 10 ( P7 d9 T; S' ]+ c& n+ J
19、调用一周热门会员 select * from uchome_space WHERE dateline>=UNIX_TIMESTAMP()* R1 O9 K4 H$ U" _
m- r& f) J. K7 c2 p" ?1 V-3600*24*7 ORDER BY viewnum DESC LIMIT 0,18 0 H' l7 o! \- ?3 ]& K% P/ {/ m) V
20、调用发过帖子且有头像的会员 SELECT * from uchome_blog s,uchome_space sf where s.uid=sf.uid and sf.avatar=1 |
|