Do it right the first time it will be faster....

PEOPLE {
person_id,fname,lname,type,title,person_phone(maybe)
}
Departments{
dept_id,dept_title,dept_phone(maybe)
}
Peoples_Departments{
person_id,dept_id,phone(maybe)}

I put phone maybe in all since I am not sure where the phone number is
attached I assume each person has 1 phone number so it would
presumably go in the People Table but if a person has a different
phone number for each dept they work in it would go in the
relationship table (Peoples_Departments). Doing it this way is much
much faster since you will not have to constantly type out weird dept
names over and over again. To answer possible future questions
assuming a table design like above you would get the person and his
departments like this:

Select peep .*,Dept.*
>From People peep INNER JOIN Peoples_Departments PD ON peep.person_id =
PD.person_id
INNER JOIN department dept ON pd.dept_id = dept.dept_id
Where dept_title = <cfqueryparam cfsqltype="cf_sql_varchar"
value="#variable.deptname#">

:)

Adam H

On Thu, 26 Aug 2004 16:29:06 -0400, daniel kessler <[EMAIL PROTECTED]> wrote:
> >2. Redo your database with a proper many to many join. Otherwise, you're in
> >for a world of hurt.
>
> I agree that it should be relational bringing together several tables, which I discussed/learned here about a month ago.  But I was given no time to implement that so I'm trying to implement this temporary kludge with the hopes of doing that when I implement the USERS table for the site.
>
> Am I getting what you're sayin?
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to