AS far as a site I have used or like is and have no affiliation with that I
have found usefull for sql because it has links to other good sites.
        http://www.vb-bookmark.com/vbSQL.html
Some basic pages are
        http://homepages.go.com/~chlee1h/sql.html
        http://www.ifs.univie.ac.at/www2/SQL/sqltut.htm

But I have found that O'Reilly Transact-SQL Programming book has been the
best for my particular development environment
        http://www.oreilly.com/catalog/wintrnssql/

Anyway... It looks like you are creating a Cartesian produc by not joining
the members table to the messages table.  Based on your code I would assume
that members.email should equal messages.from_email.  If that is the case
the following code should help.

<cfquery name="checkuser" datasource=#ds#>
SELECT
        messages.mID
        ,messagesfrom_email
        ,members.email
        ,members.password
FROM
        messages
        ,members
WHERE
        messages.mID = #form.ID#
        AND members.password = '#form.password#'
        AND members.email = '#form.email#'
        AND messages.from_email = '#form.email#'

<!--- Added to stop Cartesian Join --->
        AND members.email = messages.from_email

</cfquery>

Eric Gilbert
Developer
Stone Ground Solutions
560 Sutter St., Suite 400
San Francisco, CA 94102
415.252.0600
415.252.0123 fax
www.stoneground.com



> -----Original Message-----
> From: W Luke [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 29, 2000 2:07 PM
> To: CF-Talk
> Subject: Query Advise
>
>
> Hi,
>
> For me, SQL is either thoroughly straightforward, or bizarrely confusing.
> As soon as I try to do something remotely complicated, I run into trouble,
> simply cannot work it out, and come to you guys.  As well as
> advising me how
> to fix my latest Query - can anyone tell me of a decent SQL website for
> advanced queries, or a book?  I'd be really grateful.
>
> OK the query in question is as follows:
>
> <cfquery name="checkuser" datasource=#ds#>
>       SELECT mID,from_email,email,password FROM messages,members WHERE
> messages.mID = #form.ID# AND messages.from_email = '#form.email#' AND
> members.password = '#form.password#' AND members.email = '#form.email#'
>      </cfquery>
>
> mID and from_email are fields in the "messages" table. Password and email
> are fields in the members Table.  mID is originally set from a
> url variable,
> and for example might be set to 5.  This would return an email address
> 'from_email' - what I need to do is validate this email against one stored
> in members, check the pass, and if all is OK then move on.
>
> I've spent the whole day on this, on and off, and still it's saying "wrong
> password"!
>
> Advise much appreciated..
>
> Cheers
>
> Will
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
_talk or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to