1
In my table I have 3 columns:
id(INT)
auto incrementtipo(INT)
: the values are1
or2
id_usuario(INT)
I need a means without the WHERE
at the end to know if there is a user-specific data, and if there is a data from it, which displays the tipo(INT)
if it is 1
or 2
.
I can’t use the WHERE
at the end because I’m doing a data count together. What I currently have:
SELECT
COUNT(IF(tipo = 1, 1, NULL)) AS X,
COUNT(IF(tipo = 2, 1, NULL)) AS W,
COUNT() AS y, -->Conte se existe um dado do usuário especifico na tabela.
tipo AS Z -->Mostrar dado do usuário especifico se é 1 ou 2.
FROM tabela WHERE id='$id'