I have to disagree with "no benefit".  You might be right in terms of
performance, but having all the logic together improves
readability/maintainability.

On Tue, Mar 4, 2008 at 9:44 AM, Dawson, Michael <[EMAIL PROTECTED]> wrote:

> Change your "WHERE" to an "AND" and it should work.
>
> Although, in this case, there is no benefit to putting the additional
> criteria within the INNER JOIN.  You may as well just specify a WHERE
> clause.
>
> It does make sense, however, to specify additional criteia in an OUTER
> JOIN.
>
> http://weblogs.sqlteam.com/jeffs/archive/2007/05/14/60205.aspx
>
> m!ke
>
> -----Original Message-----
> From: Fawzi Amadu [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 04, 2008 5:35 AM
> To: CF-Talk
> Subject: Adding Extra Conditions to an INNER JOIN
>
> I am trying to use INNER JOIN for my query and have additional
> conditions, what is the right way to add them? When I run the code
> below, I get the error shown. How do I get this to work?
>
> SELECT v.Party, SUM(v.Votes), s.ConstituencyNo ,c.ConstituencyName,
> c.RegionCode FROM VoteResults v INNER JOIN PollingStation s
>      ON v.AgentPhoneNo = s.AgentPhoneNo
>                                     WHERE v.ResultCategory = 'L' AND
> v.Party = 'NPP'
>      INNER JOIN Constituency c
>      ON c.ConstituencyNo = s.ConstituencyNo
>      GROUP BY v.Party, s.ConstituencyNo, ,c.ConstituencyName,
> c.RegionCode
>
>
> Error:
>
>  Error Executing Database Query.
> [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC
> Microsoft Access Driver] Syntax error (missing operator) in query
> expression 'v.ResultCategory = 'L' AND v.Party = 'NPP' INNER JOIN
> Constituency c ON c.ConstituencyNo = s.ConstituencyNo'.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:300399
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