0
I’m with the following SQL:
SELECT id,titulo,slug,endereco
FROM empresas
WHERE
(categoria = ".$_GET['id']." OR categoria_2 = ".$_GET['id']." OR categoria_3 = ".$_GET['id'].") AND (status = '1') ORDER BY chave DESC, RAND()
But he doesn’t order through the key field and neither does Rand()
I try to manipulate the "parentheses" there the status = '1'
crashing.
How do I make that line work the structure OR
, AND
, ORDER BY
and RAND()
?
Give an example of the data you have in the table and the result you want to get
– Sorack
Some databases and some situations require the "order" cmpo to be in "select", if "key" is unique the order by Rand() would not make sense
– Motta
@Motta My database is MYSQL
– Gladison