Jump to content

Join 5 tables


snk

Recommended Posts


hello to all,

 

First of all Im sorry for bothering you with so big message. Iam trying to build a mini cms and i have 5 tables, DB design is fine for my opinon, plz correct if you realise something wrong. From past experience I have Joined multiple table via php values, i was quering a table i was puting the key of the linked table to a value and then i was quering again and again and again.

 

I think is time to move on to a better level. So Im explaining you the design and hopefuly somebody can give me the right query, coz I have spent more than a day trying JOINS and UNIONS

 

I have 5 tables: Tips, Text, Page, Category, Links

 

Page and Links belong to a category, thus I have put the category_key in Page and Links

Tips and Text belong to Page, thus I have put the page_key in Tips and Text

 

Now, instead of querying 25.ooo times the database, I would like to get back a table with All of the fields according a value that is coming with GET and represents the page_key.

 

a row flow is coming like

$page = $_GET


;

 

$query_return = SELECT page.title, text.text, links.text, links.page_key, tips.text

 

and of course later I  echo the values of the return query in the right positions, I know how to do it, plz dont bother to explain

Just, to help you to help me, I mention again that Page table is linked with Links table via Category table

 

Thank you in advance

Spiros.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.