日期:2014-05-17 浏览次数:20866 次
select
* /*此处有其它代码*/
from (
values
('张三','市场部',4000),
('赵红','技术部',2000),
('李四','市场部',5000),
('李白','技术部',5000),
('王五','市场部',NULL),
('王蓝','技术部',4000)
) as employ(name,dept,salary);
WITH t(name,dept,salary) AS (
SELECT '张三' name,'市场部' dept,4000 salary FROM dual UNION ALL
SELECT '赵红' name,'技术部' dept,2000 salary FROM dual UNION ALL
SELECT '李四' name,'市场部' dept,3000 salary FROM dual UNION ALL
SELECT '李白' name,'技术部' dept,5000 salary FROM dual UNION ALL
SELECT '王五' name,'市场部' dept,NULL salary FROM dual UNION ALL
SELECT '王蓝' name,'技术部' dept,4000 salary FROM dual
)
SELECT * FROM t;
insert into t_trans(cid,seq,input,amount) values
('zs001',1,'2000-1-1',350.00) ,
('zs001',2,'2000-1-2',140.00) ,
('ls002',3,'2000-1-3',220.00) ,
('zs001',4,'2000-1-4',270.00) ,
('ls002',5,'2000-1-5',480.00) ,
('ls002',6,'2000-1-6',660.00) ;
INSERT INTO t_trans(cid,seq,input,amount)
SELECT 'zs001' cid,1 seq,'2000-1-1' input,350.00 amount FROM dual UNION ALL
SELECT 'zs001' cid,2 seq,'2000-1-2' input,140.00 amount FROM dual UNION ALL
SELECT 'ls002' cid,3 seq,'2000-1-3' input,220.00 amount FROM dual UNION ALL
SELECT 'zs001' cid,4 seq,'2000-1-4' input,270.00 amount FROM dual UNION ALL
SELECT 'ls002' cid,5 seq,'2000-1-5' input,480.00 amount FROM dual UNION ALL
SELECT 'ls002' cid,6 seq,'2000-1-6' input,660.00 amount FROM dual ;