Jump to content

How to make Table relation?


abdfahim

Recommended Posts

I am not sure whether it is possible what I m wanting to do. I have two table "tableA" and "tableB". Now I want 2 things ..

1) "columnA1" of "tableA" automatically contains same value as "columnB1" of "tableB". If I change/add anything in "columnB1" of "tableB", it will automatically changed/added in "columnA1" of "tableA".

2)I want "columnA2" of "tableA" = Sum of ("columnB2" of "tableB") all time. "columnB2" is a integer field.

So plz help me. I m very much starter in mysql.
Link to comment
Share on other sites

That is because I want to show the website summery (like total user, online user, post ... etc) on the 1st page of my website. To do this I have to access different database and tables which i afraid may coz delay in loading the page. So what I want is to create an extra table and put the necessary field related to original tables so that I can get all the info by accessing one single table.
Link to comment
Share on other sites

Ok, the whole situation is -
I have 4 database "userdb","forumdb","newsdb","profiledb". [b]All databases are in the same server[/b], i.e. I have to connect once and then just switch database by the command "mysql_select_db()". All databases has seperate tables. Now I am afraid that switching databases 10/11 times in one page may increase the loading time of the page. So I create an extra table on "newsdb" database and trying to link this table with other table. The reason is given in my prev reply.
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.