转自:http://www.maomao365.com/?p=7205 摘要: 下文分享两条sql求和脚本,再次求和的方法分享 /* 例: 下文已知两条sql求和脚本,现需对两张不同表的求和记录再次求和 */ ---对两条求和sql脚本求和的方法 select sum(q) from ( select sum(qty) as q from tableNameA where ... union all select sum(qty) as q from tableNameB where ... )…
1.查看数据库中不为 InnoDB 引擎的表 SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('sys', 'mysql', 'performance_schema', 'information_schema', 'test') AND ENGINE != 'InnoDB'; 2.查看数据库中表的大小及数据量…
DECLARE @dt1 DATETIME,@dt2 DATETIME,@a BIGINT,@b BIGINT SET @dt1='2010-01-01'--开始日期 SET @dt2='2010-06-30'--结束日期 SELECT @a=CAST(@dt1 AS BIGINT),@b=CAST(@dt2-@dt1 AS BIGINT) SELECT CAST(ABS(CHECKSUM(newID()))%@b+@a AS DATETIME)+RAND() AS 日期…