Questions tagged as 'count'

2
answers

Make top 10 by checking 3 tables

I have 3 tables: sponsors id | id_patrocinador | id_usuario quotas id | id_user | quantidade users id | nome | login What I need to do is a TOP 10 where I list 10 users who have sponsored with active quotas. For example...
asked by 21.04.2017 / 07:05
4
answers

Performance of COUNT (*) and COUNT (1)

What is the difference between COUNT(1) and COUNT(*) in an SQL query. For example: SELECT COUNT(1) FROM USUARIOS; and SELECT COUNT(*) FROM USUARIOS; Is there any difference in interactions within SBGD? Which would...
asked by 20.06.2017 / 19:41
1
answer

Select with re occurrences of a period record

I need to know if a record has occurred again in a 7-day period. For this, I have a table that saves the records and the date of occurrence. For example: Registro: x | Data: 13/03/2017 Registro: y | Data: 14/03/2017 Registro: x | Data: 17/03/2...
asked by 04.05.2017 / 16:14
1
answer

Return amount of dependents per employee

I need to select the Plaque, Employee Name, and Dependent Amount for each Employee, but the result of that query is showing the number of dependents for the first Employee only, / p> Note: If you remove the WHERE clause, the query shows...
asked by 03.11.2018 / 20:36
3
answers

Help with SQL query with COUNT in multiple lines

Hello, I'm doing the following query SELECT p.id, c.nome, v.titulo, count(v.titulo) FROM passageiros AS p LEFT JOIN clientes AS c ON c.id = p.id_cliente LEFT JOIN viagens AS v ON v.id = p.id_viagem GROUP BY v.titulo; And it is returning...
asked by 09.12.2018 / 04:37
1
answer

Select with group by double

In MySQL I have a table named contact_status : id | id_contato | detalhamento_id 1 | 1 | 2 2 | 1 | 3 3 | 2 | 4 4 | 2 | 2 5 | 2 | 1 6 | 3 | 2 7 |...
asked by 10.07.2018 / 14:58
5
answers

Count number of MySQL query records in PHP

I made the code below to count the number of records, but it tells me 1 to 1, I would like to know how I can do to add these records and call with an echo. ?> <?php $sql="SELECT id FROM processo"; $return = $conexao->...
asked by 25.08.2017 / 17:32
1
answer

Count in multiple tables

I have 3 tables Ineedaquerythattakesthenameoftheschool,amountofclassestypeA,qtdeofclassestypeB,qtdeofstudentswhoareinclassestypeA,andqtdeofstudentswhoareinclassestypeB.>Sameasthisexample: I tried to do Select E.NOME, SUM(CASE WHEN C...
asked by 14.08.2017 / 19:03
1
answer

Count the number of records of my IF

IF (count (UCID)> 1, count (UCID), '0') , it brings me approximately 500 record lines, being numbers 2 above, I want to be able to do a COUNT in that IF to display those 500's in a separate column. Anyone have a suggestion? Thanks in advance....
asked by 06.06.2017 / 20:23
1
answer

Doubt group by + sum function

I have a problem putting a query into my mysql database for attendee attendance at an event. I have a participant table where I have participant information, and it has the attendance of those participants on days 1, 2 and 3 (th...
asked by 11.04.2016 / 21:45