Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

How to join the result of two queries

$
0
0
Guys,

I have two tables and I get the count of them like this:

--First

SELECT EXTRACT(YEAR FROM L.DATAHORALCTOFIS) ANO, COUNT(*) LANCAMENTOS
FROM LCTOFISENT L
WHERE L.ORIGEMDADO IN (1,2,3)
GROUP BY ANO
ORDER BY ANO

Result:
ANO LANCAMENTOS
2009 2100
2010 1385
2011 1289
2012 1525
2013 1621
2014 866

--Second

SELECT EXTRACT(YEAR FROM L.DATAHORALCTOFIS) ANO, COUNT(*) LANCAMENTOS
FROM LCTOFISENT L
WHERE L.ORIGEMDADO IN (1,2,3)
GROUP BY ANO
ORDER BY ANO

Result:
ANO LANCAMENTOS
2009 6588
2010 4772
2011 5122
2012 5190
2013 3379
2014 496


What I need:
Join the result of this two queries in one. Like this:
2009 8688
2010 6157
2011 6411
2012 6715
2013 5000
2014 1362


Any help???

Thanks in advance.

Viewing all articles
Browse latest Browse all 13329

Trending Articles