UCenter Home 具有数据调用功能。数据调用可以将 UCenter Home 的信息嵌入到您的普通网页中,但是有一些用户对调用的 SQL 语不太熟悉,下面为大家介绍几种常见的调用 SQL 语句 ,供参考。
1 、调用含有图片的日志
SELECT * FROM `uchome_blog` WHERE `picflag` =1;
- SELECT * FROM `uchome_blog` WHERE `picflag` =1;
2 、调用最近更新的 10 条日志
SELECT * FROM uchome_blog FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
- SELECT * FROM uchome_blog FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
3 、调用最近更新的 10 个相册
SELECT * FROM uchome_album FORCE INDEX(updatetime) ORDER BY dateline DESC LIMIT 0,10;
- SELECT * FROM uchome_album FORCE INDEX(updatetime) ORDER BY dateline DESC LIMIT 0,10;
4 、调用最近的 10 条播客
SELECT * FROM uchome_doing FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
- SELECT * FROM uchome_doing FORCE INDEX(dateline) ORDER BY dateline DESC LIMIT 0,10;
5 、调用我的话题
SELECT * FROM uchome_thread ORDER BY dateline DESC LIMIT 0,10;
- SELECT * FROM uchome_thread ORDER BY dateline DESC LIMIT 0,10;
6 、调用 3 天内回复数最多的日志
SELECT * FROM uchome_blog WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY replynum DESC
- SELECT * FROM uchome_blog WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY replynum DESC
7 、调用选吧一周内的热点话题
select * FROM uchome_thread where dateline>=UNIX_TIMESTAMP()-604800 ORDER BY viewnum DESC;
- 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;
- SELECT * FROM uchome_ thread WHERE dateline>=UNIX_TIMESTAMP()-86400*7 ORDER BY viewnum DESC;
8 、调用最近 3 天注册的人,且按照降序排列
SELECT * FROM uchome_space WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY dateline DESC;
- SELECT * FROM uchome_space WHERE dateline>UNIX_TIMESTAMP()-86400*3 ORDER BY dateline DESC;