Stef Mientki wrote:
I thought this would work,
SELECT *
FROM Patient_Text
INNER JOIN
(
SELECT *
FROM Patient
INNER JOIN Opnamen
ON Patient.PatNr = Opnamen.PatNr
)
ON Patient.PatNr = Patient_Text.PatNr
^^^^^^^^^^^^
But I get an error on the second use of Patient.PatNr.
Is there a way to get such a nested statement working ??
I'm looking for some construct that can used to generated code
from a visual design, through recursion of the links,
so it must be simple.
Stef,
The subselect produces an unnamed table as its result. If you want to
refer to its columns you must drop the table name or add an alias to the
subselect and use that name.
SELECT *
FROM Patient_Text
INNER JOIN
(
SELECT *
FROM Patient
INNER JOIN Opnamen
ON Patient.PatNr = Opnamen.PatNr
)
ON PatNr = Patient_Text.PatNr
SELECT *
FROM Patient_Text
INNER JOIN
(
SELECT *
FROM Patient
INNER JOIN Opnamen
ON Patient.PatNr = Opnamen.PatNr
) AS Pat
ON Pat.PatNr = Patient_Text.PatNr
It seems to me that you should be able to do this without a subselect
though.
SELECT *
FROM Patient_Text
INNER JOIN Patient ON Patient.PatNr = Patient_Text.PatNr
INNER JOIN Opnamen ON Patient.PatNr = Opnamen.PatNr
The links in your visual tool are just joins between the tables, no need
for the subselects.
HTH
Dennis Cote
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------