我有兩個SQL查詢那些被以下SQL查詢組合
1)SELECT a.* FROM modzzz_listing_main as a LEFT JOIN modzzz_listing_rating as b ON a.id=b.gal_id WHERE LTRIM(a.city) = 'Houston' AND a.state = 'TX' AND a.tags LIKE '%Barber Shop%' ORDER BY b.gal_rating_sum DESC LIMIT 0 ,10
2)SELECT zip_code ,(3959 * acos(cos(radians('41.97734070')) * cos(radians(latitude)) * cos(radians(longitude) - radians('-70.97234344')) + sin(radians('41.97734070')) * sin(radians(latitude)))) AS distance FROM city_finder WHERE latitude IS NOT NULL AND longitude IS NOT NULL HAVING distance < 20 ORDER BY distance ASC
我怎樣才能由條件`
modzzz_listing_main結合這兩個查詢.zip = city_finder.zip_code
'。我是完全confused..please任何一個可以幫助我..
你toooooooooooooooo輝煌.... 。:) – Preethy
其實它非常基本:)給查詢別名用作虛擬表,並加入它們 – AdrianBR