here's my table syntax: create table Projects ( PjID int unsigned auto_increment not null primary key, PjNumber varchar(40) not null, PjName tinytext not null, PjDesc tinytext, PJEcd varchar(30), PJCost varchar(30), LastUpdate char(30) );
create table Managers ( MgrID int unsigned auto_increment primary key, MgrName varchar(40) not null, PrimaryID int unsigned not null, AlternateID int unsigned not null ); create table PjStatus ( StatID int unsigned auto_increment not null primary key, PjID int unsigned not null, Actions longtext, Status varchar(10) ); create table POCs ( PjID int unsigned not null, pmyid int unsigned not null, altid varchar(5) not null, I only have two records stored in my database currently. You'll notice the "managers" table has 3 id's for each manager. MGRid is the PK only reason for that. PrimaryID and Alternate ID are both for tracking purposes. A manager might be the "primary" manager (meaning the one ultimately responsible for the project) or he may be an alternate (backing somone else up who is the primary). Therefore, these two columns will have a one to many relationship with the POCs table. Here's what I want to do: define a query that will select * from the POCs table and display that info via a php script in a table. Simple enough right? WRONG! I know plently about php but jack about SQL. My query is as follows: select mgrname, pjname from managers, projects, pocs where pjid = 'x' and pmyid = 'x' and altid = 'x' NOW! This should give me an output like this: +------------------------------------------------------------------+ |__pjname____|___mgrname(primary)___|___mgrname(alternate)_| | testproject testprimary1 testprimary2 Instead, what I get is the name of the project with EVERY single manager that I have loaded. Now I only have two records (or 2 projects) loaded into this database, but I have over 90 different project managers loaded (don't ask why, lost a bet on that one). So what happens is, I get the "testproject" name for the pjname and I get it replicated 94 different times for each and every manager that I have loaded. So it seems like every single manager is associated with this project. WTF am I doing wrong? This is going on 11 days trying to figure this out. Am I doing the joins wrong or something? Does my table design not allow me to do what I'm trying to do? Should I instead be trying to nest 3 queries in one and display the output side by side (sort of like the html talbe theory???)?????? --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php