Joint Syntax Error
Posted on 2006-11-21
I'm having the hardest time with a Select Statement, can someone please tell me what's wrong? I could have trimmed down the fields, but since I don't know where the problem is, I left everthing verbatim. Thank you!
stSQL = "Select * From (SELECT PRODUCT_NAME,PRODUCT_LOCATION, INTERVAL_NAME, VM_VMONTH, SUM(UNREALIZED_VOLUME) as QUANTITY, SUM(GAMMA) as GAMMA_QUANT FROM Positions_20060808.csv WHERE TRANSACTION_BOOK_ID IN (238, 227, 168, 230, 193, 225,169, 119, 254) AND UNREALIZED_VOLUME is not null and GAMMA is not null GROUP BY PRODUCT_NAME, PRODUCT_LOCATION, INTERVAL_NAME, VM_VMONTH) As a" & _
"LEFT OUTER JOIN Select * From (SELECT ROW_NUM, PRODUCT_NAME, PRODUCT_LOCATION, INTERVAL_NAME, VM_VMONTH , LAST_PRICE, HIST_VOL FROM VolTable20060808.csv) As b " & _
"ON a.PRODUCT_NAME = b.PRODUCT_NAME and a.PRODUCT_LOCATION = b.PRODUCT_LOCATION and a.INTERVAL_NAME = b.INTERVAL_NAME and a.VM_VMONTH = b.VM_VMONTH ORDER BY b.ROW_NUM ASC"