I have a problem, to which I have no solution.
I have four different tables and need to retrive data from all of them at once.
To the tables:
Announcements, from which I need all the data;
Categories, from which I need to grab the announcement's category title;
Subcategories, from which I need to grab the announcement's subcategory title;
Regions, from which I need the announcement's region name;
Obviously, the Announcement table has "id_category","id_subcategory" and "id_region" fields.
So, I guess the query'd be something like:
Code: Select all
SELECT Announcements.*,Categories.title,Subcategories.title,Regions.name
FROM Announcements,Categories,Subcategories,Regions
WHERE Announcements.state='something' AND Categories.id=Announcements.id_category AND Subcategories.id=Announcements.id_subcategory AND Regions.id=Announcements.id_regionWhat do you guys think? Is it possible? Can anybody enlighten me?
Thanks in advance.