sql - How can I make these two queries a single query with an inner join? -


i have these 2 queries need make single query. keyfield1 , tpolno should join fields. how go making single query?

select tpolno, sum(ttsamt) sum pfpostr410  ((ttrnyy=2012 , ttrnmm=3 , ttrndd>=27) or (ttrnyy=2012 , ttrnmm>3) or  (ttrnyy=2013 , ttrnmm<=2) or (ttrnyy=2013 , ttrnmm=3 , ttrndd<=27))  group tpolno having sum(ttsamt)>=5000 order tpolno asc  select keyfield1, keyfrobj cmrelatn relroletc=8 

thanks in advance direction!

  • josh

if understand questions, need simple inner join of 2 tables:

select tpolno, sum(ttsamt) sum, keyfield1, keyfrobj pfpostr410, cmrelatn       ((ttrnyy=2012 , ttrnmm=3 , ttrndd>=27) or (ttrnyy=2012 , ttrnmm>3) or  (ttrnyy=2013 , ttrnmm<=2) or (ttrnyy=2013 , ttrnmm=3 , ttrndd<=27))     , keyfield1=tpolno     , relroletc=8 group tpolno, keyfield1, keyfrobj having sum(ttsamt)>=5000 order tpolno asc 

Comments