飞天品牌推广微信公众平台码
石家庄飞天科技
微信公众平台
当前位置:主页 > 飞天动态 >

DedeCMS常用SQL语句这些你会用吗?

功能说明:清空所有注册会员内容
相关语句:
DELETE FROM `2d30_member` WHERE `2d30_member`.`mid` != 1;
TRUNCATE TABLE `2d30_member_flink`;
TRUNCATE TABLE `2d30_member_person`;
TRUNCATE TABLE `2d30_member_space`;
TRUNCATE TABLE `2d30_member_tj`;

数据调用型例子
调用说明:所有发布的文章总数目
相关标签:
{dede:sql sql='select count(*) as cc from 2d30_archives'}
    [field:cc/]
{/dede:sql}

功能型SQL语句整理:
功能说明:添加自定义属性
相关语句:
insert into `2d30_arcatt`(sortid,att,attname) values(9,'d','评论');
alter table `2d30_archives` modify `flag` set ('c','h','p','f','s','j','a','b','d') default NULL;

数据调用SQL语句整理:
标签说明:常用内容统计代码
相关标签:
·共有文章:** 篇
{dede:sql sql="select count(*) as c from 2d30_archives where channel=1"}·共有文章:[field:c /]篇{/dede:sql}
·共有图集:** 个
{dede:sql sql="select count(*) as c from 2d30_archives where channel=2"}·共有图集:[field:c /]个{/dede:sql}
·共有软件:** 个
{dede:sql sql="select count(*) as c from 2d30_archives where channel=3"}·共有软件:[field:c /]个{/dede:sql}
·共有评论:**条
{dede:sql sql="select count(*) as c from 2d30_feedback"}·共有评论:[field:c /]条{/dede:sql}
·共有会员:**名
{dede:sql sql="select count(mid) as c from 2d30_member "}·共有会员:[field:c /]名{/dede:sql}
·文章阅读:** 人次
{dede:sql sql="select sum(click) as c from 2d30_archives"}文章阅读:[field:c /]人次{/dede:sql}
·今日更新:**篇
{dede:sql sql="SELECT count( * ) AS c FROM 2d30_archives WHERE pubdate > UNIX_TIMESTAMP( CURDATE( ) ) "}今日更新:[field:c /]篇{/dede:sql}
总共留言:{dede:sql sql="select count(*) as cc From 2d30_guestbook"}[field:cc/]{/dede:sql}条
 

调用说明:调用Discuz论坛附件带图片的贴子
相关标签:
{dede:sql sql="SELECT` cdb_p_w_uploads`.`aid`, `cdb_p_w_uploads`.`p_w_upload`,`cdb_threads`.`tid`, `cdb_threads`.`fid`, `cdb_threads`.`subject` FROM `cdb_p_w_uploads` LEFT JOIN `cdb_threads` ON `cdb_threads`.`tid`=`cdb_p_w_uploads`.`tid` WHERE `cdb_p_w_uploads`.`readperm`='0' AND `displayorder`>='0' AND `filetype`='p_w_picpath/pjpeg' GROUP BY tid LIMIT 0,2"}
<li><A href="/bbs/viewthread.php?tid=[field:tid /]"><IMG src="/bbs/p_w_uploads/[field:p_w_upload/]"></A></li>
<li><A href="/bbs/viewthread.php?tid=[field:tid /]">[field:subject function="cn_substr('@me',30)" /]</A></li>
{/dede:sql}

快速导航
works
联系飞天 Contact Us
咨询电话0311-85048504/18395603129
石家庄市槐安西路88号卓达中苑商务大厦B座316 邮箱:sjzftkj@126.com
点击这里给我发消息 点击这里给我发消息 点击这里给我发消息
Copyright 石家庄飞天科技开发有限公司 版权所有
冀ICP备14015570号-5

冀公网安备 13010802000970号