各位前輩好小弟目前在SQL上面INNER JOIN了兩個Table
搜尋出來會有重複值的出現,想請問有沒有語法或判斷式可以把重複值過濾掉呢??
SELECT DISTINCT Antibiotic_Patient_infor.Pa_infor_ID, Antibiotic_Patient_infor.P_ID, Antibiotic_PDF_info.P_ID, Antibiotic_PDF_info.PDF_CreTime, Antibiotic_PDF_info.PDF_Path, Antibiotic_Drog_info.Certification
FROM Antibiotic_Patient_infor
INNER JOIN Antibiotic_PDF_info
ON Antibiotic_Patient_infor.P_ID = Antibiotic_PDF_info.P_ID
INNER JOIN Antibiotic_Drog_info
ON Antibiotic_Patient_infor.P_ID = Antibiotic_Drog_info.P_ID
WHERE Antibiotic_Patient_infor.P_ID
LIKE '32492'
OR Antibiotic_Patient_infor.P_Name
LIKE '32492'
ORDER BY Antibiotic_PDF_info.PDF_CreTime DESC;
select去掉Antibiotic_Drog_info.Certification
SELECT DISTINCT Antibiotic_Patient_infor.Pa_infor_ID, Antibiotic_Patient_infor.P_ID, Antibiotic_PDF_info.P_ID, Antibiotic_PDF_info.PDF_CreTime, Antibiotic_PDF_info.PDF_Path
FROM Antibiotic_Patient_infor
INNER JOIN Antibiotic_PDF_info
ON Antibiotic_Patient_infor.P_ID = Antibiotic_PDF_info.P_ID
INNER JOIN Antibiotic_Drog_info
ON Antibiotic_Patient_infor.P_ID = Antibiotic_Drog_info.P_ID
WHERE Antibiotic_Patient_infor.P_ID
LIKE '32492'
OR Antibiotic_Patient_infor.P_Name
LIKE '32492'
ORDER BY Antibiotic_PDF_info.PDF_CreTime DESC;
謝謝大大的回覆,因為Antibiotic_Drog_info.Certification算是一個驗證的欄位必須顯示在頁面上,0(未被驗證)1(已驗證)如圖一樣
想請問大大還有其他方法可行嗎??
或是從GridView上面做轉換??
重複的資料是指Pa_infor_ID,P_ID,P_ID,PDF_CreTime,PDF_Path
這幾個欄位一樣?
對 Pa_infor_ID,P_ID,P_ID,PDF_CreTime,PDF_Path
這幾個欄位沒錯 我有找到GridView Merge Cll 的功能
不知道可不可行??
我懂你意思了
用這個可以辦到How to merge cells with equal values in the GridView
感謝指點 我知道怎麼做了 謝謝!