Thread: Indenting SQL
View Single Post
Old 02-29-2008, 06:07 PM   #7 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

I just tend to split mine over multiple lines if it's a long query to make it more readable than 1 long line.

For example:

Code:
SELECT `a`.`articleid`, `a`.`title`, `a`.`content`, `m`.* 
FROM `articles` AS `a` 
INNER JOIN `authors` AS `m` 
ON a.authorid = m.authorid 
WHERE (m.name = 'Alan') AND (a.created > 1204205135) 
ORDER BY `title` ASC
As long as it's readable it doesn't really matter how you format it

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote