I am trying to make a select statement and I just cant get it work.
I have 3 tables:
places, tags, places_tags
Places:
- id
- name
Tags:
- id
- name
Places_tags:
- place_id
- tag_id
- order
I am trying to select places and join the first tag that inserted (using order)
SELECT p.*, t.tag_id AS tag
FROM `places` as p
LEFT JOIN places_tags t ON (t.place_id = p.id)
group by p.id
That’s what I have right now.
I need to add somthing like ORDER BY order DESC…
I think that I’m not doing it right.
Something like the following should work: