Announcement

Collapse
No announcement yet.

Complex SQL in a grid

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:
    SELECT
    parid,
    parnombre,
    partuser
    FROM
    "public".parametros
    WHERE EXIST (
    SELECT
    pcaid
    FROM
    "public".parametros_categories
    WHERE pcaid = 1 AND "public".parametros_categorias.parid = "public".parametros.parid)
    ORDER BY parid

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

    Thanks

  • #2
    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

    Comment


    • #3
      Hello,

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

      regards,
      Bernhard Bernsmann

      Comment

      Working...
      X