标签:
1 --不适用于有类型为text、ntext等不能执行distinct操作的字段 2 SELECT DISTINCT a.code, 3 (SELECT result FROM test b WHERE a.code=b.code AND b.type=1)AS‘初审‘, 4 (SELECT result FROM test b WHERE a.code=b.code AND b.type=2)AS‘复审‘ 5 FROM test a
1 select a.code,a.result ‘初审‘,b.result ‘复审‘ from 2 (SELECT code,result FROM test WHERE type=1) a 3 inner join (SELECT code,result FROM test WHERE type=2 ) b on a.code=b.code
标签:
原文地址:http://www.cnblogs.com/13142088/p/5692554.html