1
I have the following code in php:
$sql = "SELECT * FROM musicas_curtidas
GROUP BY musica
ORDER BY count(musica)
WHERE musica != 'Rádio Turn - Você em primeiro lugar!' AND
WHERE musica != 'Radio Turn - Não importa o seu estilo! #2' AND
WHERE musica != 'Radio Turn - Não importa o seu estilo!' AND
WHERE musica != 'Rádio Turn - Comercial' AND
WHERE musica != 'Rádio Turn - Na Balada'
DESC LIMIT 3";
You’re making a mistake for me:
You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near 'WHERE musica != 'Radio Turn - You first! ' AND ' at line 4
How can I fix this? I’m a beginner in php.
@Paulosérgioperfect child, if you have any extra doubts, just comment (or if it’s something separate, open a new question)
– Bacco
Is it possible to add a WHERE to another column? For example, WHERE image NOT IN ('...'), both at the same time, music and image.
– Paulo Sérgio Filho
@Paulosérgiofilho can make the combinations you want, but with only one WHERE. Example:
SELECT nota FROM notas WHERE nota IN ( "a", "b", "c") AND aluno_nome = "Roberto";
That is, will bring only when the name is Roberto and the note a, b or c– Bacco