日期:2014-05-17 浏览次数:20492 次
select j1.* from jxs_CarTypePrice j1
where not exists (
select 1 from jxs_CarTypePrice j2
where j1.ID>j2.ID and
j1.[Carname]=j2.[Carname]
and j1.[dealerPrice]=j2.[dealerPrice]
and j1.[factoryPrice]=j2.[factoryPrice]
and j1.[pic]=j2.[pic]
and j1.[grade]=j2.[grade]
and j1.[year]=j2.[year]
and j1.[drive]=j2.[drive]
and j1.[configuration]=j2.[configuration]
and j1.[dimensions]=j2.[dimensions]
and j1.[quality]=j2.[quality]
and j1.[engine]=j2.[engine]
and j1.[oilWear]=j2.[oilWear]
and j1.[gearbox]=j2.[gearbox]
and j1.[warranty]=j2.[warranty]
and j1.[dealer]=j2.[dealer]
and j1.[area]=j2.[area]
)
SELECT *
FROM TB a
WHERE EXISTS (SELECT 1 FROM (
SELECT a,b,c,MIN(d) D
FROM TB
GROUP BY a,b,c)b WHERE a.a=b.a AND a.b=b.b AND a.c=b.c AND a.d=b.d)