0

I'm trying to build a query that will connect three tables and I want to run this query via VBscript.

This is my working version:

 sSQL = "SELECT OPNPOS.FUND, SECRTY.TKR, SECRTY.ISIN, OPNPOS.QTY, OPNPOS.LCL_ACCINC, PRIHST.PRICE / SECRTY.FACTOR AS CENA FROM (OPNPOS INNER JOIN SECRTY ON OPNPOS.TKR = SECRTY.TKR) INNER JOIN PRIHST ON SECRTY.TKR = PRIHST.TKR WHERE OPNPOS.FUND IN " & sFUND & " AND PRIHST.PRCDATE = #" & sDATA & "# ORDER BY OPNPOS.FUND"

I need to change this query in order to see every element from OPNPOS table so I would change

FROM OPNPOS INNER JOIN

to:

FROM OPNPOS LEFT JOIN

but it gives me an error. Error: Join expression not supported. Code: 80004005

I know that there are some ways to workaround this but I've tried a lot of combinations and get no success ;/

Anyone can help me?

This is a bigger part of my VBScript:

Option Explicit

dim sDATA
sDATA = InputBox("Podaj datę w formacie MM/DD/YYYY.")

dim sPATH
sPATH = "M:\MFWIN\Data"

dim sFUND
sFUND = "('FOM','KRAKOWIA')"

dim sSQL 
sSQL = "SELECT OPNPOS.FUND, SECRTY.TKR, SECRTY.ISIN, OPNPOS.QTY, OPNPOS.LCL_ACCINC, PRIHST.PRICE / SECRTY.FACTOR AS CENA FROM (OPNPOS INNER JOIN SECRTY ON OPNPOS.TKR = SECRTY.TKR) INNER JOIN PRIHST ON SECRTY.TKR = PRIHST.TKR WHERE OPNPOS.FUND IN " & sFUND & " AND PRIHST.PRCDATE = #" & sDATA & "# ORDER BY OPNPOS.FUND"


dim conn, rs

Set conn = createobject("adodb.connection") 
Set rs = createobject("adodb.recordset") 
conn.Open "Driver={Microsoft dBASE Driver (*.dbf)};SourceType=DBF;Dbq="&sPATH 
rs.Open sSQL,conn
4

1 回答 1

0

我认为这是因为您需要说:

Left Outer Join 

而不仅仅是

 Left Join
于 2013-01-28T15:26:32.183 回答