日期:2014-05-18 浏览次数:20471 次
--> 测试数据:[test] if object_id('[test]') is not null drop table [test] create table [test]( [A1] varchar(50), [A2] varchar(10), [A3] varchar(50), [A4] varchar(8) ) insert [test] select null,null,'368bc947-1c49-463f-a612-f1731d05d90d','氨苄西林' union all select '40d19a4c-758f-4992-90a2-f1b9569f78bc','青霉素类','40d19a4c-758f-4992-90a2-f1b9569f78bc','青霉素类' union all select '4d59154b-09e4-4413-836a-09b34651f589','阿莫西林','4d59154b-09e4-4413-836a-09b34651f589','阿莫西林' union all select 'e5ba770f-5374-4340-bbff-cfcaa2e81203','药物处方集',null,null select *from( select [A1] as BH,[A2] as NAME from [test] union select [A3],[A4] from [test])a where BH is not null /* BH NAME 368bc947-1c49-463f-a612-f1731d05d90d 氨苄西林 40d19a4c-758f-4992-90a2-f1b9569f78bc 青霉素类 4d59154b-09e4-4413-836a-09b34651f589 阿莫西林 e5ba770f-5374-4340-bbff-cfcaa2e81203 药物处方集 */