Questions tagged as 'count'

2
answers

What is the interface for Countable in PHP?

I saw a certain class whose declaration was this way: class Collection implements Countable {} I noticed that she was implementing Countable , but I did not understand what that implementation was doing there. What is the purpose o...
asked by 07.10.2016 / 20:09
1
answer

COUNT (*) x COUNT (1) x COUNT (id)

I would like to better understand the difference between these ways of using the counter: select COUNT(*) from tabela select COUNT(1) from tabela select COUNT(id) from tabela This question deals with performance between two ways, but wo...
asked by 17.09.2018 / 14:15
1
answer

Using recursion to count the number of times a number appears in a list

I have created a recursive algorithm to count the number of times a certain n appears in a ls list. It seems to work if the ls list is quite small (between 10 and 100), but if it is large, type 1000, it does not seem to work...
asked by 01.01.2016 / 01:27
1
answer

Hibernate Cache with select count

Hello I have a JPQL query, with count : public Long quantidadeFaturasAbertasAssinante(Integer idAssin){ return manager.createQuery("select count(f) from Fatura f where f.dataLiquidacao IS NULL and f.assinante.id = :ass", Long...
asked by 11.10.2016 / 21:06
0
answers

Countdown timer but when it reaches zero it resumes?

I have adapted a regressive timer that I found here on the net and adapted to what I want. It is to be used in a cycling event and in a time trial stage where cyclists depart every 2 minutes. It works but I can not loop so that when it reaches z...
asked by 22.05.2015 / 20:57
2
answers

Conversion specified is not valid

I'm doing a query with LINQ on DataTable in that snippet of code. I have to check if there is already a link for person registered in the database. My query using LINQ is working perfectly, the problem is to store query.C...
asked by 16.10.2015 / 14:54
1
answer

Count / Dense_rank grouped sql

I'm trying to group the rows by group in sqlserver and as a result I want to: CICLO | CODFIL | CODITPROD | ROW 1 | 1 | 10 | 1 11 | 1 | 10 | 2 12 | 1 | 10 | 3 1 | 2 | 10 | 1 11...
asked by 23.05.2018 / 16:17
2
answers

MySQL count in substrings in the columns of a varchar field

I have the following sample table: ID_USER | FRUTAS ----------------------------- 1 | Laranja;Banana;Maçã 2 | Abacaxi;Laranja;Uva 3 | Pera;Laranja;Banana;Melão It would be possible to perform a select count with order...
asked by 15.02.2018 / 20:14
1
answer

Divide sum and count result into the same Query?

The code below works, but I wanted to know how to do it all right in query , and if the way I'm setting it up is really the best way. $query = Avaliar::select(DB::raw('COUNT(id) as contar'), DB::raw('SUM(nota) as total')) ->where('...
asked by 19.12.2017 / 05:14
2
answers

How can I execute this query with Laravel 5?

How would I run the following query in Laravel 5: SELECT *, (SELECT COUNT('anuncios'.'cat-id') FROM 'anuncios' WHERE 'anuncios'.'cat-id'='categoria'.'cat-id') AS 'cat-total' FROM 'categoria' ORDER BY 'cat-nome' ASC     
asked by 23.03.2016 / 03:44