Dave, don't you subscribe to the "INNER JOIN" syntax?

SELECT    email
FROM       condensed INNER JOIN maillist ON condensed.ID2 = maillist.ID2

Greg

On Fri, 15 Oct 2004 18:12:07 -0400, Dave Watts <[EMAIL PROTECTED]> wrote:
> > Am I going about selecting from two tables in the right manner?
> >
> > 1. Select all email addresses (variable Email) from Table
> > "condensed". ID2 is the index
> >
> > 2. Then the entire record for the  email addresses ((variable
> > Email2) table "mailist"  that match the email addresses in
> > Table "condensed"
> >
> > Code:
> >
> > <CFQUERY NAME="OuterLoop" DATASOURCE="BusinessDB#"  DBTYPE="ODBC">
> > SELECT *
> > FROM condensed, maillist
> > WHERE  ID2 = ID2 AND Email = '#Email2#'
> > </CFQUERY>
>
> I'm not exactly sure what you're doing with those two tables, but you're not
> specifying which fields come from which tables in your WHERE clause. Do both
> tables have a field called ID2? Is it the primary key for one of the tables?
> Is it the foreign key for the other table? If you want to select all the
> email addresses from the "condensed" table, why are you filtering by email
> address in your query?
>
> It sounds to me like you'd be better served with this:
>
> SELECT c.Email, m.*
> FROM   condensed c, maillist m
> WHERE  c.ID2 = m.ID2
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> phone: 202-797-5496
> fax: 202-797-5444________________________________
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to