If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Relating to a new table in mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-22-10, 04:31
linux1880 linux1880 is offline
Registered User
 
Join Date: Jul 2010
Posts: 39
Relating to a new table in mysql

Hi friends,
I have just added a 'groups' table to mysql database. I already have a member table that has a group_id field. Should I relate member members of members table to different groups in php or mysql?
Please it would help a lot if you can give me some example code.
Reply With Quote
  #2 (permalink)  
Old 09-22-10, 07:54
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
definitely you should relate the tables with sql, not php

for example
Code:
SELECT members.username
     , groups.groupname
  FROM members
LEFT OUTER
  JOIN groups
    ON groups.id = members.group_id
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On