0
Need to do an if in the example postgres.
SELECT
log."data" AS log_data,
log."tipomovimento" AS log_tipomovimento,
log."nomefornecedor" AS log_nomefornecedor,
log."nomeproduto" AS log_nomeproduto
FROM
"public"."log" log
WHERE
if(log."nomefornecedor" != null) {
log."data" BETWEEN '2018-01-01' and '2018-06-30'
and log."tipomovimento" IN ('S') and
"nomefornecedor" = 'x';
}else{
log."data" BETWEEN '2018-01-01' and '2018-06-30'
and log."tipomovimento" IN ('S')
}
If the supplier is not null it will filter supplier, if it is null it will not filter supplier on Where. Would anyone have any idea ?
It worked too, thank you
– Leandro Santos