Posts by EstevaoLuis • 396 points
9 posts
-
1
votes1
answer41
viewsA: Select by days of the month returning 0 when there is no record of that day
That was the best solution I could find. I hope I can help you. SELECT T2.id_criador, T2.dia, COALESCE(qnt, 0) AS qnt FROM ( SELECT inicio, COUNT(*) qnt, id_criador FROM chamado GROUP BY id_criador,…
-
0
votes2
answers414
viewsA: What is the code to print only the first number of a value? ex: only the 8 of 8372883
Thus? #include <stdio.h> int main(){ int a, primeiro; printf("Insira um numero: "); scanf("%i",&a); primeiro=a; while(primeiro >= 10) { primeiro = primeiro / 10; } printf("Primeiro…
canswered EstevaoLuis 396 -
5
votes3
answers82
viewsA: Sequenced array within dropdown
Using a foreach and an accountant $i <datalist class="" id="browsers" > <?php $i = 0; // declaração do contador foreach($produto as $p){ ?> <option value="<?php echo…
-
3
votes2
answers857
viewsA: Calling a function with the variable name
Using window["Nome_função"](argumentos), thus: window["Inicio_" + (valor que vier no parametro)](); That is to say window["Inicio_" + prg](); Where prg is the variable that will come as parameter.…
javascriptanswered EstevaoLuis 396 -
2
votes1
answer343
viewsA: Calling route from a button is not working
The right way is this: <button type="submit" class="btn btn-primary"><a routerLink="/operator">Criar</a></button>
-
1
votes4
answers27603
viewsA: SQL - Calculate percentage in the same select
You can use a sub-query SELECT Data, Passed, Failed, CAST(ROUND((Passed * 100.0) / (Passed + Failed), 2) AS DECIMAL(5,2)) FROM ( SELECT Data, SUM(CASE WHEN Status = 'OK' THEN 1 ELSE 0 END) as…
-
1
votes2
answers4641
viewsA: How to store a SELECT value in a MYSQL variable?
Thus set @userID = (select User_id from userdocuments where Description = @CPF)
mysqlanswered EstevaoLuis 396 -
2
votes3
answers2185
viewsA: How to create and remove div s with inputs dynamically with jquery
To add code dynamically with jQuery, you can use the method append. $("#frmCadastro").append('<div class="row"> ... </div>'); Or if you want to change the content, you can use the method…
jqueryanswered EstevaoLuis 396 -
7
votes1
answer2068
viewsA: COUNT and GROUP BY in two columns
The function SUM() does not work with type data Time. That’s why you have to use the functions TIME_TO_SEC and SEC_TO_TIME to convert time to a number of seconds and vice versa. SELECT serial_lote,…