my table have several records which has the same MemberID. i want to result out only one record.
select DISTINCT(MemberID) from AnnualFees;
then result will come. but i want to show the other column data also but when i do this
select DISTINCT(MemberID),StartingDate,ExpiryDate,Amount from AnnualFees;
all the details including same MemberID data also displaying.
can someone help me.
Assuming you just want any row at random for each memberid than you can do this:
If you wanted a specific row per memberid, e.g. the one with the most recent StartDate then you could modify it to: