...

View Full Version : complex query?



MeGa
01-27-2004, 12:17 AM
OK, I have this MySQL querry:
@mysql_query("SELECT * FROM `url` WHERE `url1` != '' AND `credits1` != 0 OR `url2` != '' AND `credits2` != 0 OR `url3` != '' AND `credits3` != 0 OR `url4` != '' AND `credits4` != 0 OR `url5` != '' AND `credits5` != 0 OR `url6` != '' AND `credits6` != 0 ORDER BY RAND();", $connection);I want to focus on this:
`url1` != '' AND `credits1` != 0 OR `url2` != '' AND `credits2` != 0would MySQL interpreat it as
(`url1` != '' AND `credits1` != 0) OR (`url2` != '' AND `credits2` != 0)Thanks for the help.

raf
01-27-2004, 12:28 AM
Why post this in the PHP forum?

I don't know how mySQL would interpret it, so i just use parentheses so that i'm sure it gets evaluated in the order i want it to.

You should also realise that 0 isn't the same as Null (<-- an empty cell, which is what i suppose you are looking for)

MeGa
01-27-2004, 03:25 AM
I know that 0 != NULL thing... and well, yeah, think I misplaced it

I just though about, why not actually including the brackets? lol

thanks anyways



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum