Multiple AND statement error

Hi guys,

I have problems with multiple “AND” statement from 2 tables.

I have this WORKING mysql query :
$items = “SELECT * FROM products, users WHERE users.email=‘email@email.com’ AND products.code=users.code ORDER BY time DESC LIMIT 30”;

And when I add one more statement it just returned error:
$items = “SELECT * FROM products, users WHERE users.email=‘email@email.com’ AND products.code=users.code AND products.pricea < products.priceb ORDER BY time DESC LIMIT 30”;

“AND products.pricea < products.priceb” this give me problems.

Any solution for this?

Thanks

please show the error message that you got

It’s weird!! (I’m new to mysql) but now it’s working… :smiley:

I use this query…

$items = "SELECT * FROM products, users WHERE products.pricea < products.priceb AND users.email=‘email@email.com’ AND products.code=users.code ORDER BY time DESC LIMIT 30

I rearrange the condition accidentally.