Help me write a SQL query : )
-
I think I have figured out how to access a certain piece of info I need in the database. The only problem is I have never written MySQL code before – and the piece of info I want spans 3 tables.
Here is the relation:
-In the first table (term_taxonomy) I need to select a particular item in the “description” area and its related “term_taxonomy_ID” found along the same row.-Then I move to table 2 (“term_relationships”), here I use the “term_taxonomy_ID” I found – I need to look along the row and get the corresponding “object_ID”
-On to table 3 (posts) I need to use the “object_ID” I got from the last table. Its the same as the “ID” of the post i’m after. Once I have found the post via ID I need everything from that row – i’ll need to use the content, title etc.
So, from what I have seen other people doing I think this is possible if I use an “inner-join” to link the tables together?
One more thing, this query will need to return multiple posts. they all start with the same description like step 1, but there will be a few posts to return.
Please, educate me on SQL. I hope its do-able!
- The topic ‘Help me write a SQL query : )’ is closed to new replies.