mysql - Php sql DISTINCT row id without duplicate -
select distinct buyer,caseid,subject,service s_support order id desc
result is
buyer subject service caseid abel@gmail.com ---- need ---- other ---- 438613 bani@gmail.com ---- urgent ---- other ---- 438612 rony@gmail.com ---- ---- other ---- 438611
i want view id
in distinct how? wants hide duplicates keep 1 row per buyer/subject/service/case keep row id.
id buyer subject service caseid 9 abel@gmail.com ---- need ---- other ---- 438613 7 bani@gmail.com ---- urgent ---- other ---- 438612 6 rony@gmail.com ---- ---- other ---- 438611
the question unclear looking this.
try both of in mysql_query()
, keep 1 fits need (if any)
eliminate duplicates , keep lowest id
select min(id) id, buyer,caseid,subject,service s_support group buyer,caseid,subject,service order id desc
eliminate duplicates , keep highest id
select max(id) id, buyer,caseid,subject,service s_support group buyer,caseid,subject,service order id desc
if not, rewrite question in intelligible manner :)
Comments
Post a Comment