mysql总结

复制表
 create table erp_wangwangcopy select * from erp_wangwang;

查询失败的条目倒序
SELECT * FROM `weixin_faild_record` ORDER BY `send_time` desc;

select tid,buyer_nick  from jdp_tb_trade  where buyer_nick in(select buyer_nick from jdp_tb_trade group by buyer_nick having count(*)>1) ;

$sql ="select * from jdp_tb_trade where status in('TRADE_FINISHED','WAIT_SELLER_SEND_GOODS','WAIT_BUYER_CONFIRM_GOODS') and jdp_modified between '".$start_time."' and '".$current_time."'";

select uid,FORMAT(sum(money),2) as moneys,status from wx_lottery_win where check_code!='已兑奖' and lottery_date BETWEEN '2016-09-20' and '2016-12-16' GROUP BY uid HAVING moneys >=1

自动增加
UPDATE erp_wangwang SET wx_nc=wx_nc+11 WHERE  wangwang_no='tb74707632' AND open_id='owRy9jjdxufnhpo0T_cbqB6rUKJk';

你可能感兴趣的:(sql-database)