Fix query rif. fattura in ordini

This commit is contained in:
MatteoPistorello 2021-07-15 12:00:58 +02:00
parent 181513d963
commit 7fc886b033
1 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ FROM `or_ordini`
GROUP BY `idordine` GROUP BY `idordine`
) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine` ) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine`
LEFT JOIN ( LEFT JOIN (
SELECT GROUP_CONCAT(co_documenti.numero_esterno SEPARATOR \", \") AS info, co_righe_documenti.idordine FROM co_documenti INNER JOIN co_righe_documenti ON co_documenti.id = co_righe_documenti.iddocumento GROUP BY idordine SELECT GROUP_CONCAT(DISTINCT co_documenti.numero_esterno SEPARATOR \", \") AS info, co_righe_documenti.idordine FROM co_documenti INNER JOIN co_righe_documenti ON co_documenti.id = co_righe_documenti.iddocumento GROUP BY idordine
) AS fattura ON fattura.idordine = or_ordini.id ) AS fattura ON fattura.idordine = or_ordini.id
WHERE 1=1 AND `dir` = ''entrata'' |date_period(`data`)| WHERE 1=1 AND `dir` = ''entrata'' |date_period(`data`)|
HAVING 2=2 HAVING 2=2
@ -119,7 +119,7 @@ FROM `or_ordini`
GROUP BY `idordine` GROUP BY `idordine`
) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine` ) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine`
LEFT JOIN ( LEFT JOIN (
SELECT GROUP_CONCAT(co_documenti.numero_esterno SEPARATOR \", \") AS info, co_righe_documenti.idordine FROM co_documenti INNER JOIN co_righe_documenti ON co_documenti.id = co_righe_documenti.iddocumento GROUP BY idordine SELECT GROUP_CONCAT(DISTINCT co_documenti.numero_esterno SEPARATOR \", \") AS info, co_righe_documenti.idordine FROM co_documenti INNER JOIN co_righe_documenti ON co_documenti.id = co_righe_documenti.iddocumento GROUP BY idordine
) AS fattura ON fattura.idordine = or_ordini.id ) AS fattura ON fattura.idordine = or_ordini.id
WHERE 1=1 AND `dir` = ''uscita'' |date_period(`data`)| WHERE 1=1 AND `dir` = ''uscita'' |date_period(`data`)|
HAVING 2=2 HAVING 2=2