求一条sql语句,假设在oracle中有一张表emp,表中有字段id,name,sex,card;
已知一条信息id为34;
获取信息格式为
id,value,filename
34 张三 name
34 男 sex
34 ID9890 card
要求sql不是写死的
WITH A AS ( SELECT E.ID, E.NAME VALUE, 'name' FILE_NAME FROM emp E ) , B AS ( SELECT E.ID, E.SEX VALUE, 'sex' FILE_NAME FROM emp E ) , C AS ( SELECT E.ID, E.CARD VALUE, 'card' FILE_NAME FROM emp E ) SELECT * FROM A UNION SELECT * FROM B UNION SELECT * FROM C