1衙傀,刪用戶:
DELETE FROM user
WHERE id
IN (101915,101914)
2,查詢?nèi)堪l(fā)布小程序數(shù):
SELECT * FROM wechat_micro_review
WHERE template_id
=462
3五嫂,查詢審核成功的小程序數(shù)量
SELECT * FROM wechat_micro_review
WHERE template_id = '453' and status = 0 and publish_status = 0 order by status
SELECT * FROM wechat_micro_review
WHERE template_id
!=462 AND scene_code IN(1,2,3,4,5,6)
4烁涌,跨表查詢
SELECT * FROM wechat_micro_review
WHERE biz_code
= (SELECT biz_code FROM wechat_open WHERE nick_name = '收銀利器' and delete_mark = 0)
5颓遏,刪除表1中含有表2id的數(shù)據(jù)
delete from 表1 where id in (select id from 表2)
6,刪除表1中id和name同時(shí)等于表2的數(shù)據(jù)
delete from 表1 where exists (select 1 from 表2 where 表1.id=表2.id and 表1.name=表2.name);
6粮宛,更新表
UPDATE biz_property SET value= '0' WHERE p_key = 'is_show_flag' and biz_code = 'shop01CFUCRVNP'
7窥淆,新增字段(發(fā)布)
alter table wechat_micro_record_detail add column record_description varchar(100) not null default '0' comment '發(fā)布描述' after wechat_msg;
8,唯一字段設(shè)置
create unique index cms_category_title on cms_category(title);
9,復(fù)制并更新字段
INSERT INTO sys_menu(name,url,icon,delete_mark,delete_timestamp,gmt_created,gmt_modified) SELECT 'xixi',url,icon,delete_mark,delete_timestamp,gmt_created,gmt_modified from sys_menu where name = 'hehe';