Hallo,
   I have two queries:

First (results: ANNO, IMPONIBILE):
select
   EXTRACT(YEAR FROM DT.DATA_DOCUMENTO) AS ANNO,
   SUM(DC.IMPORTO) AS IMPONIBILE
from
   DOC_CORPO DC,
   DOC_TESTA DT,
   VOCI V
WHERE
   DT.ID = DOC_TESTA_ID
   AND DT.DOCUMENTO_ID <> 'PRO'
   AND EXTRACT(YEAR FROM DT.DATA_DOCUMENTO) = 2013
   AND DC.VOCE_ID = V.ID
   AND V.CONTRIBUTI = 1
GROUP BY EXTRACT(YEAR FROM DT.DATA_DOCUMENTO)


Second (results: ANNO, IMPOSTA):
select
   EXTRACT(YEAR FROM DT.DATA_DOCUMENTO) AS ANNO,
   SUM(DC.IMPORTO) AS IMPOSTA
from
   DOC_CORPO DC,
   DOC_TESTA DT
WHERE
   DT.ID = DOC_TESTA_ID
   AND DT.DOCUMENTO_ID <> 'PRO'
   AND EXTRACT(YEAR FROM DT.DATA_DOCUMENTO) = 2013
   AND DC.VOCE_ID = 'ENPACL'
GROUP BY EXTRACT(YEAR FROM DT.DATA_DOCUMENTO)

There is a way to merge those two queries to obtain the same result in 
one query that results: ANNO, IMPONIBILE, IMPOSTA?

Thanks.

-- 

Luigi Siciliano
--------------------------



------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-dig...@yahoogroups.com 
    firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

  • ... Luigi Siciliano luigi...@tiscalinet.it [firebird-support]
    • ... 'Edward Mendez' emendez...@nc.rr.com [firebird-support]
    • ... 'E. D. Epperson Jr' dixonepper...@gmail.com [firebird-support]
    • ... Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]

Reply via email to