terryds Posted June 7, 2013 Share Posted June 7, 2013 (edited) Hi, guys... Can you tell me what's the difference between SELECT column FROM table WHERE TRUE and SELECT column FROM table And SELECT column FROM table WHERE 1=1 Thanks for any answers Edited June 7, 2013 by terryds Link to comment Share on other sites More sharing options...
justsomeguy Posted June 7, 2013 Share Posted June 7, 2013 There's no functional difference. Link to comment Share on other sites More sharing options...
terryds Posted June 8, 2013 Author Share Posted June 8, 2013 So, What's the importance of using 'WHERE TRUE' ? I see some php-sqlprogrammers use this... Link to comment Share on other sites More sharing options...
justsomeguy Posted June 10, 2013 Share Posted June 10, 2013 The only reason I'll do something like that is if I have a list of possible where conditions that I may add to the query, and want to make sure there is at least one condition so that everything else can have AND before it. Using those conditions has no other effect on a query, they just tell it to return all rows. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now