To make your query more readable, can you alias your tables?

>  SELECT g.groupid, g.groupimage, g.groupname, g.groupcity, g.state,
        g.voicingid, g.groupcontactperson, g.country, g.region,
        gtx.groupid, gtx.grouptype, gt.grouptype
>  FROM tblgroups g, tblgrouptypes gt, tblgrouptypes_x gtx
>  WHERE g.groupid = gtx.groupid
>  AND gtx.grouptype = gt.grouptype
>  AND (gtx.grouptype = 'College'
>  AND gtx.grouptype = 'Jewish')
>  ORDER BY g.groupsortname

If you take out one or the other, does it return the results?


On Mon, Mar 3, 2008 at 4:39 PM, Will Tomlinson <[EMAIL PROTECTED]> wrote:
> Hey,
>
>  I've got groups that can have one or more types associated with them. I have 
> a linking table that I'm querying and filtering. But I'm not getting the 
> results I need.
>
>  Example: A group can be both 'College' and 'Jewish', as listed in the many 
> linking table - tblgrouptypes_x.grouptype
>
>  In my query below, I'm looking for groups that are both 'College' and 
> 'Jewish', but getting no results. Even though I know there is one in there. 
> Seems simple enough.
>
>  SELECT tblgroups.groupid, tblgroups.groupimage, tblgroups.groupname, 
> tblgroups.groupcity, tblgroups.state, tblgroups.voicingid, 
> tblgroups.groupcontactperson, tblgroups.country, tblgroups.region, 
> tblgrouptypes_x.groupid, tblgrouptypes_x.grouptype, tblgrouptypes.grouptype
>  FROM tblgroups, tblgrouptypes, tblgrouptypes_x
>  WHERE tblgroups.groupid = tblgrouptypes_x.groupid
>  AND tblgrouptypes_x.grouptype = tblgrouptypes.grouptype
>  AND (tblgrouptypes_x.grouptype = 'College'
>  AND tblgrouptypes_x.grouptype = 'Jewish')
>  ORDER BY tblgroups.groupsortname
>
>  And ideas would be appreciated.
>
>  Thanks,
>  Will
>
>  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

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

Reply via email to