0
I’m doing a query where, I have 3 columns related by a text filter Where '.' Like %xxx%'
, where each row of the column has a different filter (a Like %xxx%
different).
I tried to mount cases but I could not, follows below as I thought:
Select `Estruturada_Duplicata`.`duplicata_comment`, `Estruturada_Duplicata`.`duplicata_value`
from(
Select `Estruturada_Duplicata`.`duplicata_comment`, `Estruturada_Duplicata`.`duplicata_value`
Case when (duplicata_comment = '%restri%') then count(`Estruturada_Duplicata`.`duplicata_comment`), sum(`Estruturada_Duplicata`.`duplicata_value`) end restricao,
Case when (duplicata_comment = '%protesto%') then count(`Estruturada_Duplicata`.`duplicata_comment`), sum(`Estruturada_Duplicata`.`duplicata_value`) end protesto
from(`dataform`.`estruturada_duplicata`)
)
LIMIT 1;
I also tried with Queries, but I couldn’t structure it because you can only bring one column per sub. If not clear in the code: a query column will only bring the texts duplicata_comment
, another count how many comments there are with specified filter, and another add the duplicate value with the specified filter.
I’ve been testing this solution in some ways, but it keeps going wrong. Duplicate Counts always give the same value, regardless of the condition. And the sum of the values always gives zero.
– Feitosafelipe