このクエリを実行すると、次のエラーが発生します。
SELECT count(*) AS COUNT,
((ACOS(SIN(
(SELECT latitude
FROM cities
WHERE name = 'london' & country = 'gb')*PI()/180) *
SIN((cities.latitude)*PI()/180)+COS(
(SELECT latitude
FROM cities
WHERE name = 'london' && country = 'gb')*PI()/180)*COS((cities.latitude)*PI()/180)*COS((
(SELECT longitude
FROM cities
WHERE name = 'london' && country = 'gb')-
(cities.longitude))*PI()/180))*180/PI())*60*1.1515) AS distance
FROM tbl_products
LEFT JOIN members ON tbl_products.seller = members.id
LEFT JOIN business ON tbl_products.seller = business.bid
INNER JOIN cars ON tbl_products.prod_id = cars.prod_id
LEFT JOIN car ON cars.car = car.id
LEFT JOIN cities ON members.location = cities.id
LEFT JOIN regions ON cities.region = regions.code && cities.country = regions.country
WHERE tbl_products.title LIKE '%|mazda%' ESCAPE '|'
OR tbl_products.description LIKE '%|mazda%' ESCAPE '|' && regions.country = 'gb' HAVING distance <= '30';
サブクエリは複数の行を返します。
特定の距離内でレコードを取得する方法を考えていました。