justed learned to use the "where"
( like $query="SELECT * from news where approved = 1"; )
But is it possible to use 2 of these? ( like $query="SELECT * from news where approved = 1 where author = Nick"; )
...sorry for my bad english...
more then one "where" ?
Started by Veng, Mar 02 2006 12:06 PM
4 replies to this topic
#1
Posted 02 March 2006 - 12:06 PM
#2
Posted 02 March 2006 - 12:17 PM
yes it would be:
SELECT * FROM `news` WHERE `approved` = '1' AND `author` = 'Nick'
Just stick the AND in there, and you can use it as many times as you need!
SELECT * FROM `news` WHERE `approved` = '1' AND `author` = 'Nick'
Just stick the AND in there, and you can use it as many times as you need!
Edited by deadly, 07 March 2006 - 02:26 AM.
#3
Posted 02 March 2006 - 12:37 PM
Same question and answer 
http://www.pixel2lif...showtopic=18703
In short, just read this:
http://dev.mysql.com...cting-rows.html
http://www.pixel2lif...showtopic=18703
In short, just read this:
http://dev.mysql.com...cting-rows.html
#4
Posted 06 March 2006 - 04:13 PM
Woah two where clauses is WRONG!
Don't listen to that. If it works that's great but that is just TERRIBLE practice.
Quote
SELECT * FROM `news` WHERE `approved` = '1' AND WHERE `author` = 'Nick'
Don't listen to that. If it works that's great but that is just TERRIBLE practice.
SELECT * FROM blah WHERE condition = 1 AND this = 2 OR this = 3
#5
Posted 07 March 2006 - 02:26 AM
opps i didnt see i put 2 Where's in, i meant what lang put, only need the one Where clause lol
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
