select x.*
from tableA as x
Inner Join (select city_d,city_a,zone_id,airl
from tableA
Group by city_d,city_a,zone_id,airl
) as Y
on x.id=y.id
order by x.id
Assuming ID is the primary key of the table
select x.*
from tableA as x
Inner Join (select city_d,city_a,zone_id,airl
from tableA
Group by city_d,city_a,zone_id,airl
) as Y
on x.city_d=y.city_d
and x.city_a=y.city_A
and x.zone_id=y.zone_id
and x.airline=y.airline
and x.fare=y.fare
and x.id=y.id
order by x.id
if id isn't the primary key
order by x.id
or
Main Topics
Browse All Topics





by: daletianPosted on 2007-05-22 at 10:16:17ID: 19135663
SELECT MIN(FARE) FARE, CITY_A,CITY_D, ZONE_ID
FROM TABLEFARES
GROUP BY CITY_A,CITY_D, ZONE_ID