I need to select products with a value below 300 reais in which the situacao
column is equal to 2
:
Example: in the shopping table I have 8 products registered:
1 sapato valor 25 situacao 1
2 calça valor 50 situacao 2
3 meia valor 60 situacao 2
4 sandália valor 70 situacao 1
5 bicicleta valor 120 situacao 2
6 pc core 2 duo valor 250 situacao 2
7 notebook valor 500 situacao 2
8 ipad 8 gb valor 600 situacao 2
I tried to do this, but it did not work:
$query = mysql_query("SELECT valor, MAX($valor) FROM ofertas WHERE situacao = '2'") or print (mysql_error());
$query = mysql_query("SELECT valor,FROM ofertas WHERE MAX($valor) AND situacao = '2'") or print (mysql_error());
Being that I need it done in the format above or as simple as possible.