1
I need a query, in MYSQL, that checks the penultimate record and that this record is equal to a certain value, and that counts the amount of records found.
Ex: penultimate record is John’s. I need to count the number of times John appears as penultimate record.
I tried this way, putting a group by, but I was unsuccessful:
SELECT COUNT(*) FROM chamado AS chmd
INNER JOIN complemento AS comp ON (comp.num_chamado = chmd.num_chamado)
WHERE comp.nome like 'joao%'
GROUP BY comp.num_chamado
ORDER BY comp.id_complemento DESC LIMIT 1,1
Would anyone have any suggestions?
id_complement is sequential ?
– Rovann Linhalis
yes, it’s sequential
– Thiago Alessandro
Thiago, have you solved your problem? please check any of the answers
– Rovann Linhalis