日期:2014-05-16 浏览次数:20723 次
DATE_FORMAT(a.Created_time,'%Y-%m-%d %H:%i:%S') ?as c_time
?
有人告诉说1代表的是索引字段,和数组一样,1的话就是第二个字段带索引!那统计这个字段count(1)比count(*)快!如果不带索引,那么count(*)比count(1)快!?
?
DATE_FORMAT(max(b.time),'%Y-%m-%d %H:%i')
?
if(t.default_photo_id is null,'',t2.photo_path) zone_photo
?
update t_zone_appraisement set zonevalue=zone_value+?,update_time=now()
?
if(is_default_member ='1','(默认)','') default_desc
?
where 1=1?
?
case when zgp.is_limit='1' and sum(zup.order_number) >=zgp.purchase_count /*限量商品且已拼购商品数量不超过拼购计划总量*/ then '2' /*拼购进行中*/ else
? ? ? ? ?case when now()< zgp.validate_time then '1' else '2' /*status为0,且当前时间大于拼购报名结束时间则为2,拼购进行中,否则可以报名*/end ? ? ?
? ? ? end
? ? when zgp.status='1' then
? ? ? ? ? ?'2'/*拼购的后台已确认*/
? ? when zgp.status ='2'/*2,拼购成功*/then '4'?
? ? when zgp.status ='3'/*3失败*/ or zgp.status ='4'/*4,下线*/ then '3'/*拼购结束*/ ? ? ?
end as ustatus/*用户前台拼购状态1,报名中2,拼购进行中3,拼购结束4,拼购成功*/
?
select FORMAT((UNIX_TIMESTAMP(date_format(b.validate_time,'%Y-%m-%d')) - UNIX_TIMESTAMP(date_format(now(),'%Y-%m-%d')))/60/60/24,0)) as countDay
?
?CASE WHEN a.payment_id is not null THEN
? 0
? ELSE
? ?b.group_purchase_price - b.subscription
? END as balance
?
createtime > DATE_SUB(now(),INTERVAL 7 DAY) ) sumintegral ? DATE_SUB() 函数从日期减去指定的时间间隔。
?
to_days(b.created_time) = to_days(now())
?
if(UNIX_TIMESTAMP(endtime)>UNIX_TIMESTAMP(now()),DATE_FORMAT(endtime,'%Y-%m-%d'),"0") ?as valid
?
(YEAR(CURDATE())-YEAR(c.birthday)) ? ?- (RIGHT(CURDATE(),5)<RIGHT(c.birthday,5)) ? AS age
?
DATEDIFF(date_format(now(),'%Y-%m-%d 00:00:00'), date_format(ai.validate_time,'%Y-%m-%d 00:00:00'))=1
?
?
if(0=?join_count,'0%',concat(round(100*if(c.check_count is null,0,c.check_count)/?join_count),'%')) per
?
if(OCTET_LENGTH(pi.postName)>30, concat(SUBSTRING(pi.postName,1,13), '...'),pi.postName) postName,?
?
? concat(SUBSTRING(pi.capability,1,200), '...') capability, ?
?
if(OCTET_LENGTH(if(pi.has_anonymous=1,ci.anony_name,ci