ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   INNER JOIN problem (https://www.excelbanter.com/excel-programming/350751-inner-join-problem.html)

stefantem[_16_]

INNER JOIN problem
 

a = "SELECT T1.field1, T1.field2 FROM Table1 AS T1 INNER JOIN Table2 AS
T2 ON T1.ID=T2.ID WHERE T2.field3=1"
Set rs = db.OpenRecordset(a)
It works

but
a = "SELECT T1.field1, T1.field2, T3.field4 FROM Table3 AS T3 INNER
JOIN (Table1 AS T1 INNER JOIN Table2 AS T2 ON S.ID_REL=R.ID_REL) ON
T1.ID=T2.ID WHERE T2.field3=1"

Set rs = db.OpenRecordset(a)
it doesn't work (Run-time error '3122': You tried to execute a query
that does not include the specified expresion 'field1' as part of an
aggregate function.)


--
stefantem
------------------------------------------------------------------------
stefantem's Profile: http://www.excelforum.com/member.php...o&userid=13594
View this thread: http://www.excelforum.com/showthread...hreadid=502409



All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com