I have a Serviços(Nro_Serv, Data, Cliente, Valor) table and would like to get customers who did service with me in a year X (ex: 2011) and who also did in a year Y (ex: 2012). I tried to use COUNT(*) and then GROUP BY Cliente HA...
I have 3 tables as follows:
Intb_user,Ihavetwotypesofusers(buyer,seller)inanENUMfieldtodifferentiatetheusertype.IntheshoppingcartIhavetheuserIDs,product,andtransactionnumber.Ilink2timestotb_usuariotoknowwhoboughtandwhosold.IwanttoperformaS...
I need to mount a VIEW with three fields, but one depends on the other to be calculated (two of them are from the same table in different lines I need to "link" them), how do I add those fields in one place?
The select's are as follows:
SELECT...
In the person table you have the following information
ID | NOME | É_ALUNO | É_RESPONSAVEL
1 | ALUNO | TRUE | FALSE
2 | RESPON| FALSE | TRUE
There is another table with the name responsavel_aluno , this table has t...
I have the following sql query:
select nome, data, situacao from cadastro
The result is like this:
MARIA 01/01/2018 0
MARIA 15/01/2018 1
GISELE 15/01/2018 0
CICERA 08/01/2018 1
ANTONIA 20/01/2018 0
ANTONIA 15/01/2018 1...
I have a table in MySQL as follows and structure:
I would like to execute a SQL query that would do the following operations:
Total number of records ( total1 );
Count how many records have id_nps_answer between 0 and 6 ( total2 )...
I have a question about assembling a select.
I have 3 tables that relate M: N as follows:
CurrentlyI'musingthissql:selectp.descricao,(selectdescricaofromitemwhereitem.codigo=c.codigoItem)asitemsfromprodutopinnerjoincomposicaoconc.codi...
I am setting up a job agency website and I have a search that looks in the field title and description, what the person searched, as per the query below:
SELECT *
FROM vagas
WHERE (titulo LIKE '%termo_de_busca%' OR observacoes LIKE '%termo_de_...
I have the following table sir_ter_conversa which is a history of conversations.
id|idterreno|idincorporadora|idusuario|msg|data
1 | 1 | 771 | 771 | a |2018-05-27 10:20:00
2 | 1 | 771 | 773 | b |2...