I have two queries:
SELECT * FROM postcodelatlng, shops WHERE shops.postcode=postcodelatlng.postcode;
SELECT * FROM postcodelatlng, tesco WHERE tesco.postcode=postcodelatlng.postcode;
idea is that I would like to use lat and lng from first query and use it as variable as lat1 and lng1
and the take second query and use the same way to get lat2 and lng2
Finally i should have like ($lat1, $lng1, $lat2, $lng2) (Start point vs End point)
I believe you are looking sth like:
SELECT *
FROM postcodelatlng
INNER JOIN tesco ON tesco.postcode = postcodelatlng.postcode
WHERE postcodelatlng.lat IN (
SELECT lat
FROM postcodelatlng
INNER JOIN shops
WHERE shops.postcode = postcodelatlng.postcode
)
AND postcodelatlng.lng IN (
SELECT lng
FROM postcodelatlng
INNER JOIN shops
WHERE shops.postcode = postcodelatlng.postcode
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.