Questions tagged as 'case'

2
answers

Update with Case When you need to where?

UPDATE bethadba.FOFILHOS SET CPF = CASE WHEN CODI_EMP = 61 AND I_EMPREGADOS = 156 AND i_filhos = 1 THEN '00551366133' WHEN CODI_EMP = 57 AND I_EMPREGADOS = 290 AND i_filhos = 1 THEN '00636170993' WHEN CODI_EMP = 61 AND I_EMPREGADOS = 333...
asked by 11.06.2018 / 19:20
1
answer

Using Switch Case for Intervals

My teacher passed an exercise in which we should use the cases of a switch to handle intervals, he said strictly that we should use the switch and we can not use if nor while/do . I've tried the following code: switch(saldo)...
asked by 24.11.2017 / 18:17
2
answers

Using case in field null

I have the following structure tb_bulletin: |Cod|boletim|dt_enviado| | 1 | N | NULL | | 2 | S |24/08/2018| | 3 | S | NULL | | 4 | S |23/08/2018| | 5 | S |23/08/2018| | 6 | S | NULL | | 7 | N | NULL |...
asked by 24.08.2018 / 15:19
1
answer

Using Case When with LeftJoin

I am putting together a proc, but depending on the value of a parameter, I would like the left join to be different. I have tried the querys below: This works, however, else as null or even else , if the parameter COD_...
asked by 07.08.2016 / 22:45
2
answers

Ruby - comparison of values between a range or greater than, less than

I'm starting to study programming so, it's a very beginner question. I tested below to learn about case in Ruby , current_time = ARGV.first.to_i case current_time when 0..45 then puts('First Haf') when 46..90 then puts('Second Haf'...
asked by 19.02.2018 / 19:37
1
answer

For inside a Java Switch

Good evening, I would like to know if there is a way to declare a 'FOR' within a SWITCH CASE in Java because Netbeans is accusing a bug well in this part. I'm trying to make an application to play a guessing game just like I read on the site...
asked by 21.04.2016 / 04:11
1
answer

Group cells case when empty sql

I am making a query in the database to know in which branch the customer paid a portion and what the normal value and interest that was paid. The parcel value is transaction 3 in the bank and the interest amount is transaction 59. Follow t...
asked by 17.12.2018 / 19:45
3
answers

problem with select case

I'm doing select with case comparing different statuses of the same field and counting them in separate columns. The problem is that the first column gets NULL until the list of the second ends the count. Then this is reversed. My quer...
asked by 31.08.2018 / 14:03
1
answer

Compare NULL using CASE SQL

I have to retrieve 2 fields in this query (number of projects and the management that performs such a project). This query is going to be used to generate a report in JASPER and it does not display field with NULL value, so I want to for...
asked by 08.05.2017 / 16:14
2
answers

Why does the if or case test not work in this subquery?

I'm trying to run the following subquery inside a view: (SELECT if(idnotas > 0, "não", "sim") FROM notas WHERE vendas_idvendas = p.vendas_idvendas ORDER BY idnotas DESC LIMIT 1 ) as primeiraFatura, Howeve...
asked by 27.12.2018 / 12:49