Chris,

I am ALLL about the white space:

SELECT
        t1.id,
        t1.name
        (
                ISNULL( t1.foo, '' )
        ) AS foo 
FROM
        table1 t1
INNER JOIN
        table2 t2
ON
        (
                        t1.fid = t2.id
                AND
                        t2.date_createdd IS NOT NULL
                AND
                        t2.id IN
                        (
                                SELECT
                                        b.id
                                FROM
                                        bar b
                        )
        )
WHERE
        t1.id IN ( 1, 2, 3, 4, 5 )
AND
        (
                        1 = 0
                OR
                        (t1.id % 2) = 1
        )
ORDER BY
        t1.id ASC,
        t2.id ASC



Maybe this is totally crazy, but to me the indentation makes it look
VERY OBVIOUS. Granted I am used to reading it but it is super easy for
me to look at it and see how things are related (grouped together with
parens, AND'ed OR'ed, sub query , etc).


......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-----Original Message-----
From: Peterson, Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 01, 2007 3:14 PM
To: CF-Talk
Subject: Formatting your SQL Statements

I just want a quick 'style survey' on how folks key in SQL inside of CF.
Do you use a lot of white space for easy readability, or do you cram
everything onto 1 line with no aliased tables for streamlined
efficiency? For example, here is one of mine:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271169
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