select collection_id,character1 ,character3 ,'' as s ,'' as T,'' as 缺點
from Qa_Results
where character1 = 'A' and collection_id in
( select collection_id from Qa_Results where RECEIPT_NUM = '304110034')
order by collection_id,receipt_num
union
select C.collection_id,C.character1 ,C.character3 ,'s' as s ,D.character1 as T,D.CHARACTER3 as 缺點
from Qa_Results C,Qa_Results D
where C.collection_id = D.collection_id and
length(D.CHARACTER1) > 1 and
C.character1 = 'R' and C.collection_id in
( select collection_id from Qa_Results where RECEIPT_NUM = '304110034')
order by C.collection_id,C.receipt_num
from Qa_Results
where character1 = 'A' and collection_id in
( select collection_id from Qa_Results where RECEIPT_NUM = '304110034')
order by collection_id,receipt_num
union
select C.collection_id,C.character1 ,C.character3 ,'s' as s ,D.character1 as T,D.CHARACTER3 as 缺點
from Qa_Results C,Qa_Results D
where C.collection_id = D.collection_id and
length(D.CHARACTER1) > 1 and
C.character1 = 'R' and C.collection_id in
( select collection_id from Qa_Results where RECEIPT_NUM = '304110034')
order by C.collection_id,C.receipt_num
COLLECTION_ID CHARACTER1 CHARACTER3 S T 缺點
65869 R 拒絕 s TBD-04 主缺點
65872 R 拒絕 s TFO-99 次缺點
65877 A
65877 R 拒絕 s VPS-17 主缺點
65886 A 接受
65889 A 接受
65896 A
65896 R 拒絕 s VPS-02 次缺點
65899 R 拒絕 s TBD-01 主缺點
65902 R 拒絕 s TBD-02 主缺點
多產生空行已經解決select collection_id,character1 ,character3 ,'' as s ,'' as T,'' as 缺點
from Qa_Results
where character1 = 'A' and collection_id in
( select collection_id from Qa_Results where RECEIPT_NUM = '304110034')
union
select C.collection_id,C.character1 ,C.character3 ,'s' as s ,D.character1 as --!!!!!!!!T,D.CHARACTER3 as 缺點
from Qa_Results C,Qa_Results D
where C.collection_id = D.collection_id and
length(D.CHARACTER1) > 1 and
C.character1 = 'R' and C.collection_id in
( select collection_id from Qa_Results where RECEIPT_NUM = '304110034')上面's' as s ,D.character1 as --!!!!!!!!中's' as s 但我數據庫中不僅有值s還有A和I兩個值
怎麼從數據庫中提出來呢?
謝謝