好久没来咱们博客园了,主要近期在忙一些七七八八的杂事,包括打羽毛球比赛的准备和自己在学jqgrid的迷茫.先不扯这些没用的了,希望大家能记得小弟,小弟在此谢过大家了. 回归正题:(以下的sql是本人在用yii框架开发项目时写的,希望对大家有些帮助) 首先是多表查询,为了简化我先贴出自己的代码,在贴出解释代码. select a.*, b.*, c.* from rlzy_payfeeinf a inner join rlzy_personinfo b on a.bid=b.bid join rl…
常用于分库分表 1.批量删除 declare @outter int declare @inner int ) ) ) begin set @tablePrefix='BankPayOrder_'+convert(varchar,@outter)+'_' ) begin set @tableName=@tablePrefix+convert(varchar,@inner) execute('delete from '+@tableName+'') end end 2.批量建表 declare @…
一.去重 1.查询出重复的记录 CREATE TABLE push_log_full_2013_10_30_tmp SELECT * FROM `push_log_full` WHERE time BETWEEN FROM_DAYS(TO_DAYS(NOW()) - 1) AND FROM_DAYS(TO_DAYS(NOW())) AND (imsi, andriodid, time) IN ( SELECT imsi, andriodid, time FROM `push_log_full`…
1.存储过程动态表查询 USE [NETWORKING_AUDIT] GO /****** Object: StoredProcedure [dbo].[impConfigInfo] Script Date: 01/04/2019 08:39:55 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: wm -- Cr…