Ravi,

The best way to display (related) information from more than one table is to
use a JOIN. Pick up a SQL reference book to get more info. SQL is far more
useful if you know how to use JOINs. They're usually faster too...especially
when you get only the records you really want.

Here's an example:

        <cfquery name="loginCheck" datasource="#APPLICATION.dsn#">
            SELECT    c.clubId,
                                c.shortName,
                                cM.clubMemberId,
                                cLM.clubId,
                                cLM.clubMemberId,
                                cM.loginName,
                                cM.password_2
            FROM    club as c
                INNER JOIN clubMember cM ON c.clubId = cM.clubId
                INNER JOIN clubLinkMember cLM ON cM.clubMemberId = 
cLM.clubMemberId
                WHERE cM.loginName = '#FORM.loginName#'
                AND cM.password_2 = '#FORM.password#'
        </cfquery>


-----Original Message-----
From: Ravi Gehlot [mailto:[EMAIL PROTECTED]
Sent: Friday, May 18, 2007 6:22 AM
To: CF-Talk
Subject: [QUAR] query logic


 Can I check 3 different tables at the same time like in this query? Is
this logic ok?

        <cfquery name="loginCheck" datasource="#APPLICATION.dsn#">
            SELECT    c.clubId,
                                c.shortName,
                                cM.clubMemberId,
                                cLM.clubId,
                                cLM.clubMemberId,
                                cM.loginName,
                                cM.password_2
            FROM    club as c,
                            clubMember as cM,
                            clubLinkMember as cLM
            WHERE    c.shortName = #URL.shortName#
            AND        cM.loginName = '#FORM.loginName#'
            AND        cM.password_2 = '#FORM.password#'
            AND        cLM.clubMemberId = cM.clubMemberId
            AND        cLM.clubId = cM.clubId
        </cfquery>

--
-------------------------------------------
Ravi Gehlot.
Sr. Management
Sunshine Technology Solutions, LLC
http://www.sunshinetechsolutions.com/
-------------------------------------------

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278739
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to