Complex SQL in a grid

I need to develop a grid on a table but only on records whose primary key exists in another table.

The SQL command would be something like:

[INDENT]SELECT
[INDENT]parid,
parnombre,
partuser[/INDENT]
FROM
[INDENT] “public”.parametros
[/INDENT]
WHERE EXIST (
[INDENT] SELECT
[INDENT] pcaid
[/INDENT] FROM
[INDENT] “public”.parametros_categories
[/INDENT] WHERE pcaid = 1 AND “public”.parametros_categorias.parid = “public”.parametros.parid)
[/INDENT]ORDER BY parid

[/INDENT]

But this command fails if I indicate in the SQL option of the application

Thanks

Hi,
try the following statement:

SELECT
parid,
parnombre,
partuser
FROM
parametros
WHERE
parid IN (SELECT
parid
FROM
parametros_categories
WHERE pcaid = 1)
ORDER BY parid

Hope this helps.
jsb

Hello,

Another alternative besides JSB suggestion is to create a VIEW of that query.

regards,
Bernhard Bernsmann