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 This shows the following results: 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.
dbo.testMaster.Name, join dbo.testDetail INNER from testDetail.Status dbo.testDetail.testID = dbo.testMaster.ID
Deal with Khalid Khalid Khalid with False Hameed Fail Hamid with Maooke
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 = dbo.testMaster.ID group by dbo.testMaster.Name; You can use the string representation number of the position and to get the minimum position for each name. Then convert back.
Comments
Post a Comment