标签:ar 使用 sp art bs ad ef 工作 as
1、exists/not exsists
select b.yid yid, b.ytid ytid from t_user a, t_yidytidmapping b where a.fk_origin_user = b.ytid and not exists (select * from t_user d where b.yid = d.fk_origin_user);
2、插入批量结果集、mysql日期函数使用
insert into t_pack_item(gid, free_count, buy_count, start_time, end_time, user_id) ( select (b.g_type * 100000 + b.business_id) gid, 1 free_count, 0 buy_count, now() start_time, (select date_add(now(), interval 100 * 365 day)) end_time, a.fk_origin_user user_id from t_user a, t_shop_product b where a.fk_origin_user = 301787931 and a.user_level > 0 and b.id in(3,4,5,6,7) order by a.fk_origin_user );
3、关联更新
update t_user a ,t_guizu_privilege b set a.fk_special_effects = b.fk_special_effects where a.user_level = b.level;
标签:ar 使用 sp art bs ad ef 工作 as
原文地址:http://my.oschina.net/u/565430/blog/352180