Subject | Re: [firebird-support] SQL help please |
---|---|
Author | Helen Borrie |
Post date | 2005-02-24T07:53:08Z |
At 09:02 AM 24/02/2005 +0200, you wrote:
the same thing.
Make it a habit to properly separate join criteria from search criteria,
though. Some class interfaces, particularly those that do magic with
replaceable parameters, have trouble parsing statements that jumble up
static syntax elements with dynamic ones...clean code habits tend to make
your work self-documenting, too.
./hb
>Will the following two queries give the same results? Is there a beneifit toStylistically the second one is correct, although logically both achieve
>doing it either way?
>
>SELECT SUM(Y.TOTAL) FROM TABLEONE X
>LEFT OUTER JOIN TABLETWO Y ON X.LINK = Y.LINK AND Y.DELETED = 'N'
>WHERE X.LINK = 1
>
>SELECT SUM(Y.TOTAL) FROM TABLEONE X
>LEFT OUTER JOIN TABLETWO Y ON X.LINK = Y.LINK
>WHERE X.LINK = 1 AND Y.DELETED = 'N'
the same thing.
Make it a habit to properly separate join criteria from search criteria,
though. Some class interfaces, particularly those that do magic with
replaceable parameters, have trouble parsing statements that jumble up
static syntax elements with dynamic ones...clean code habits tend to make
your work self-documenting, too.
./hb