Keith McElroy
asked on
adodb sql multi tables
How do I adjust this sql so that it will LEFT OUTER JOIN to GM230 two times, one for each fy:
SELECT a.GMUDY, a.GMFUND, a.GMDPT, a.GMDIV, a.GMSTAB, a.GMELM1, a.GMELM2, a.GMOBJ,
a.GMFNDS, a.GMDPDS, a.GMDVDS, a.GMSBDS, a.GMSSDS, a.GMELDS, a.GMOBDS, a.GMAC14, a.GMACFM, b.GMYREV, c.GMYREV, b.GMYREV, c.GMYREV FROM HTEDTA.GM200DB a
LEFT OUTER JOIN HTEDTA.GM230 b ON a.GMFUND=b.GMFUND and a.GMDPT=b.GMDPT and a.GMDIV=b.GMDIV
and a.GMSTAB=b.GMSTAB and a.GMSTAS=b.GMSTAS and a.GMELM1=b.GMELM1 and a.GMELM2=b.GMELM2 and a.GMOBJ=b.GMOBJ LEFT OUTER JOIN HTEDTA.GM230 c ON a.GMFUND=c.GMFUND and a.GMDPT=c.GMDPT and a.GMDIV=c.GMDIV and a.GMSTAB=c.GMSTAB and a.GMSTAS=c.GMSTAS and a.GMELM1=c.GMELM1 and a.GMELM2=c.GMELM2 and a.GMOBJ=c.GMOBJ WHERE b.GMFYR = 2015 AND c.GMFYR = 2014
SELECT a.GMUDY, a.GMFUND, a.GMDPT, a.GMDIV, a.GMSTAB, a.GMELM1, a.GMELM2, a.GMOBJ,
a.GMFNDS, a.GMDPDS, a.GMDVDS, a.GMSBDS, a.GMSSDS, a.GMELDS, a.GMOBDS, a.GMAC14, a.GMACFM, b.GMYREV, c.GMYREV, b.GMYREV, c.GMYREV FROM HTEDTA.GM200DB a
LEFT OUTER JOIN HTEDTA.GM230 b ON a.GMFUND=b.GMFUND and a.GMDPT=b.GMDPT and a.GMDIV=b.GMDIV
and a.GMSTAB=b.GMSTAB and a.GMSTAS=b.GMSTAS and a.GMELM1=b.GMELM1 and a.GMELM2=b.GMELM2 and a.GMOBJ=b.GMOBJ LEFT OUTER JOIN HTEDTA.GM230 c ON a.GMFUND=c.GMFUND and a.GMDPT=c.GMDPT and a.GMDIV=c.GMDIV and a.GMSTAB=c.GMSTAB and a.GMSTAS=c.GMSTAS and a.GMELM1=c.GMELM1 and a.GMELM2=c.GMELM2 and a.GMOBJ=c.GMOBJ WHERE b.GMFYR = 2015 AND c.GMFYR = 2014
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.