摘要:UPDATE t_invests INNER JOIN t_user_coupons ON t_invests.user_coupon_id = t_user_coupons.id SET t_invests.virtual_product_id = t_user_coupons.virtual_product_id WHERE t_user_coupons.virtual_produc...
阅读全文
摘要:select timestamp(date_add(curdate(), interval - day(curdate()) + 1 day))当月0点时间:2015-12-01 00:00:00select timestamp(date_add(NOW(), interval - day(NOW(...
阅读全文
摘要:http://www.w3cschool.cn/sql_having.html w3c中有些SQL的讲解1 order by 排序SELECT Company, OrderNumber FROM Orders ORDER BY Company;2 distinct 去重SELECT DISTINCT...
阅读全文
摘要:第五章 元数据查询 查询数据库本身信息 表结构 索引等5.1 查询test库下的所有表信息MYSQLSELECT * from information_schema.`TABLES` WHERE TABLE_SCHEMA = 'test';ORACLEselect table_name from a...
阅读全文
摘要:第四章 插入更新和删除4.1 插入数据insert into dept (deptno,dname,loc) values (50,'PROGRA','NEW YOURK');4.2 从一个表向另一个表中复制insert into dept_east(deptno,dname,loc)select ...
阅读全文
摘要:第三章 操作多个表表连接的内连接和外连接A表 B表id name id name 1 a 1 b 2 b 3 ...
阅读全文
摘要:第二章 查询结果排序2.1 按查询字段排序select ename,job,sal from emp where deptno = 10 order by sal asc;select ename,job,sal from emp order by deptno, 3 desc;-- 3表示sal...
阅读全文
摘要:本文内容摘自SQL.Cookbook一书第一章 select1.1 按条件查询select * from emp where deptno = 10 or comm is not null or sal = 4000 then 'OVERPARD' else 'OK' end ...
阅读全文
摘要:用sql语句查询结果拼接字符串命令SELECT CONCAT(A.ofm_path_id,'-',A.distribute_address_id,'-',A.distribute_rule_id),A.in_file_abs_name, b.service_instance_name,b.insta...
阅读全文