2
I have the following excerpt from a CASE in my SQL
SELECT CASE WHEN (tabela01.data_abertura - INTERVAL tabela02.garantia 'month') <= tabela01.data_nf
THEN 'Dentro do Prazo'
ELSE 'Fora do Prazo'
END AS medicao_garantia
... Where:
- data_opening: Start date of a call
- data_nf: Date of the product invoice
- Warranty: Quantity of months the product is under warranty
I have to calculate the INTERVAL
, but I’m missing the syntax.
I’ve tried to:
INTERVAL(tbl_produto.garantia 'month')
INTERVAL 'tbl_produto.garantia month'
INTERVAL tbl_produto.garantia 'month'
But without satisfactory results.
Which error appears? try concatenating the warranty value with Month, see if it works:
INTERVAL tabela02.garantia || ' month'
– rray
The mistake is the famous
Syntax error
, and always refers to the table02.garantia. Your solution had no changes, continues in Syntax error– William Aparecido Brandino