select profile.id, profile.status, unix_timestamp(new_date) as unix_new, profile.name as profile_name, profile.img_path, profile.short_name as short_name, profile.summary, profile.username, profile.address, profile.zip, zip_city.city, keyword.name, profile_type.type_id, type.name, other.name, profile.xpon_card, profile.lat, profile.lng from profile left join (profile_type) on (profile.id=profile_type.profile_id ) left join (type) on (profile_type.type_id=type.id) left join (profile_keyword) on (profile.id=profile_keyword.profile_id) left join (keyword) on (profile_keyword.keyword_id=keyword.id) left join (zip_city) on (profile.zip=zip_city.zip) left outer join (profile_other) on (profile_other.profile_id=profile.id) left outer join (other) on (profile_other.other_id=other.id) left join (profile_district) on (profile_district.profile_id=profile.id) left join (district) on (profile_district.district_id=district.id) where profile.status !="inactive" and xpon_card=1 group by profile.id order by ((profile.zip>=1000 and profile.zip<=2999) or (profile.zip>=3700 and profile.zip<=3799)) desc, rand() Spisegavekortet