Code: Select all
SELECT
*
FROM
vwBolleVendita
WHERE
Azienda = '{Azienda}'
AND bvt_databolla between '{da_Data_Bolla}' AND '{a_Data_Bolla}'
AND (bvt_idcausalebolla = 2 OR bvt_idcausalebolla = 8) -- 2 = Causale_bolla "VENDITA" 8 = Resi da clienti
AND Tipo_Bolla =
CASE
WHEN '{Tipo_Bolla_da_Stampare}' = 'SCONTRINO e FATTURA A PRIVATI' AND Tipo_Bolla = 'SCONTRINO' THEN 'SCONTRINO'
WHEN '{Tipo_Bolla_da_Stampare}' = 'SCONTRINO e FATTURA A PRIVATI' AND Tipo_Bolla = 'FATTURA A PRIVATI' THEN 'FATTURA A PRIVATI'
WHEN '{Tipo_Bolla_da_Stampare}' = 'VENDITA' AND Tipo_Bolla = 'VENDITA' THEN 'VENDITA'
WHEN '{Tipo_Bolla_da_Stampare}' = 'VENDITA' AND Tipo_Bolla = 'RESO CLIENTE' THEN 'RESO CLIENTE'
ELSE ''
END;
I am having a problem in every report I create. When there is a date filter like the one in this query (
Code: Select all
AND bvt_databolla between '{da_Data_Bolla}' AND '{a_Data_Bolla}'
Any other report that does not have a date filter but uses the same syntax works perfectly. Can someone help me resolve this issue?
Additional Information:
The query is using MySQL syntax.
The date filter is using the BETWEEN operator.
The report is not showing any data when the date filter is applied.
Other reports that do not have a date filter are working fine.
The date values in the bvt_databolla column are in the correct format. Both bvt_databolla, da_Data_Bolla and a_Data_Bolla are Datetime values.
I have already tried using the DATE() function to extract the date from the bvt_databolla column, it didn't work.
I have already tried using a different filter like "WHERE bvt_databolla >= '{da_Data_Bolla}' AND bvt_databolla <= '{a_Data_Bolla}'", it didn't work, in fact, the report started to give Timeout exception errors.