I need help building a mysql query to select from multiple tables.
I have three database tables related to images: images, tags, tag_asc. I want to fetch an image data and its tag names by providing image_id.
For example, following is my tables structure:
images:
image_id image_name path date
1 test.jpg dir 1311054433
tags:
tag_id image_id
1 1
2 1
tag_asc:
tag_id tag_name
1 "first"
2 "second"
3 "third"
I want to fetch the data of an image with image_id = 1 from images table and all tag names associated with image_id=1 from tag_asc table.
I'm using CodeIgniter Active records, but I just need idea of joining the tables.
Thanks for any help.