Subject [IBO] Re: Ambiguous field name between tables ...
Author svein_erling
>I'm not familiar with the use of the colon in sql, but the line,
>WHERE CO.CD = :CD, bothers me. Should not :CD be, perhaps, :EU.CD?

No Jack, colon is just the way you tell IBO that it is a parameter.

So with
SELECT CO.CD
, CO.NOME
, EU.EMPRUSU_ID
, EU.CORR_ID
FROM EMPR_USU EU
JOIN CORR CO
ON CO.CORR_ID = EU.CORR_ID
WHERE CO.CD = :CD
AND EXISTS ( SELECT 1
FROM PJ
WHERE PJ.CORR_ID = CO.CORR_ID )

you call your query like this:

IB_Query1.ParamByName('ID').AsInteger:=1; //or another value
IB_Query1.First;

Parameters are very useful and you can save a lot of time not having
to reprepare the query if their value change.

Set