OK, I just bought an O'Reilly book on mysql and it's on it's way, so soon I will stop asking these stupid questions (hopefully) but for now...
I have table one with business info, table two with points info, and table three (that relates them) with business_id & points_id. How do i select all the business information, but with the lat and lon values from points...
my tables:
businesses:
id
name
owner
address
phone
points:
id
lat
lon
businesses_points:
business_id
point_id
Another stupid question (relational select)
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
something like
Code: Select all
SELECT
`businesses`.*
FROM
`points`
LEFT JOIN
`businesses_points`
ON
`points`.`id` = `businesses_points`.`point_id`
LEFT JOIN
`businesses`
ON
`businesses_points`.`business_id` = `businesses`.`id`
WHERE
`points`.`lat` = '123'
AND
`points`.`lon` = '321'