Home : General : Databases and SQL :

General: Databases and SQL: Re: [Stealth] query help: Edit Log

Here is the list of edits for this post
Re: [Stealth] query help
Thank your for the assist. Let me see if I can understand your suggestion but I think there is still a problem because I get an error message... Here's my query using my tablenames and such and for simplicity I'll ignore the Links table for now... my problem is I want to get two entries from the Sponsors table for each row... one for sponsor1id and one for sponsor2id. Here's my query

SELECT Activities.name,Activities.date,Sponsors.name,Sponsors.name

FROM Activities

LEFT JOIN Sponsors ON Sponsors.sponsorid = Activities.sponsor1id

LEFT JOIN Sponsors ON Sponsors.sponsorid = Activities.sponsor2id

WHERE Activities.week = 1

When I run this query I get the following error message

ERROR 1066: Not unique table/alias: 'Sponsors'

This is what has me baffled. I don't want to have to run a query on each record, I could literally end up with hundreds of them to get one page for the site. Is there something I'm missing or doing wrong, or can this just not be done?

And is a LEFT JOIN more efficient (server load wise) than matching in the where clause or is it just a personal programming preference?

Last edited by:

JerryP: Aug 29, 2002, 3:00 PM

Edit Log: