日期:2014-05-17 浏览次数:20368 次
CREATE TABLE T_CSDN_ONE
(
ID VARCHAR(50),
MC VARCHAR(100),
PID VARCHAR(50)
)
INSERT INTO T_CSDN_ONE
SELECT
'01','集团','0'
UNION ALL
SELECT
'0101','公司1','01'
UNION ALL
SELECT
'010101','生产部','0101'
UNION ALL
SELECT
'01010101','A班','010101'
UNION ALL
SELECT
'0102','公司2','01'
UNION ALL
SELECT
'010201','采购部','0102'
UNION ALL
SELECT
'0103','公司3','01'
UNION ALL
SELECT
'0104','公司4','01'
SELECT * FROM T_CSDN_ONE WHERE ID NOT IN
(
SELECT PID FROM T_CSDN_ONE
)