sql - How make query with unique? -
i have query:
select top 20 f.id_service f_id_service, f.id_city f_id_city, f.name f_name, f.address f_address, f.business f_business, f.web f_web, f.phone f_phone, f.id_firm f_id_firm firm f left join price p on p.id_service = f.id_service , p.id_city = f.id_city , p.id_firm = f.id_firm f.name not in (select distinct top 20 f.name firm f f.blocked = '0' , ( f.name 'АВТО%' or f.phone 'АВТО%' ) , ( f.phone != '' or f.address != '' ) , f.id_city = '73041' order f.name asc) , f.dogovor = '1' , f.blocked = '0' , ( f.name 'АВТО%' or f.phone 'АВТО%' ) , ( f.phone != '' or f.address != '' ) , f.id_city = '73041
tell me please how make query select unique f.name ?
change select this
select distinct top 20 f.name f_name ...
you can't have columns values distinct 1 of them: makes no sense.
Comments
Post a Comment