Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to use allies names in ON condition

$
0
0

i have the following query.

SELECT
  DD.DATE_KEY
, (SELECT MIN(NVI_DATE) AS NVI_MIN_DATE FROM FCT_SPA_NVI_OUTRIGHT A WHERE A.VENDOR_CODE=V.VENDOR_CODE) AS NVI_MIN_DATE
, VO.BANK_ACCOUNT_NO
, VO.BANK_NAME
, VO.BANK_ROUTING_NO

FROM DIM_VENDOR V

LEFT JOIN FCT_SPA_NVI_OUTRIGHT VO
 ON V.VENDOR_CODE = VO.VENDOR_CODE

LEFT JOIN FCT_SPA_NVI_MERCHANDISE VP
 ON VO.NVI_KEY=VP.NVI_KEY

LEFT JOIN DIM_DATE DD
 ON VO.NVI_DATE=DD.DATE_FLD

in the above query, how to use NVI_MIN_DATE in the ON condItion like.,

LEFT JOIN DIM_DATE DD
 ON NVI_MIN_DATE=DD.DATE_FLD

Thanks in advance.


bala krishna


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>