It's no the primary keys that need to be =. What you need is to have a
foreign key in the table that holds the email. So, for example, you'd
have:
empower_local_case_studies
studyid (PK)
name 
etc

empower_registration
registrationid (PK)
studyid (FK)
etc.

Then, you'd join:
WHERE erc.studyid = er.studyid

Does that make sense?

On 6/7/05, daniel kessler <[EMAIL PROTECTED]> wrote:
> >You should probably qualify the columns in your where clause, and with
> >table-names of this length, I would definately use aliases. See if
> >this helps any.
> 
> I was going to, but didn't remember right-off how to do so.  I've done so 
> now, thanks.
> 
> >SELECT ecs.*,er.email
> >FROM empower_local_case_studies ecs,
> >  empower_registration er
> >WHERE ecs.page = (param 1) AND ecs.project = (param 2)
> >  AND (ecs.local_case_study_id = er.registration_id)
> >ORDER BY ecs.local_case_study_id ASC
> >
> >Does the registration_id really match the local_case_study_id? -- it
> >looks like you're joining the primary key on both tables... not that
> >doing that would have to be invalid, but this doesn't seem like the
> >sort of situation where I would expect that.
> 
> I thought that this is how I relate the tables.  Really, I'm just trying to 
> have the email address from the registration DB as part of the returned 
> information.  I was following a tutorial and it said to make sure the primary 
> keys are =.  Here's the tutorial I was using:
> http://www.w3schools.com/sql/sql_join.asp
> 
> Is this not right?  I'm always interested in learning.
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208793
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to