sql server - Select Distinct Records from two tables -
Two tables (column ID, mastertable with name) with columns (MasterID, status) I join two tables and choose dbo.testMaster.Name, join dbo.testDetail INNER from testDetail.Status dbo.testDetail.testID = dbo.testMaster.ID This shows the following results: Deal with Khalid Khalid Khalid with False Hameed Fail Hamid with Maooke I used to buy Khaled A. If he has been given a "value" value, then he should leave aside and fail for it. For Hamid we have two records but should go back to withdrawing priority so that he should fail for Hameed. Mike has only one record, so he should choose his record. Post-text "itemprop =" text "> select dbo.testMaster.Name, case (case testDetail.Status when 'close' then 1 when 'WithDraw' then 2 when 'unsuccessful' then 3 End) when 1 'pass' 2 then 'tooth' occurs when 3 'unsuccessfully' end up with dB test.detail INNER JOIN dbo.testMaster ON dbo.testDetail.testID...