Thread: Cross Apply

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0

    Question Cross Apply


    Hi,

    I am rewriting some SQL Server SPs into PostgreSQL functions one of them uses a CROSS APPLY in a SP similar to this:

    SELECT
    t.col1,
    t.col2,
    ca.col1,
    ca.col2
    FROM
    tableTest t
    CROSS APPLY fn_whatever(t.col3, t.col4) AS ca

    I have wrote and tested the function fn_whatever which works ok but I cannot work out how to use.

    I tried:

    SELECT
    t.col1,
    t.col2,
    ca.col1,
    ca.col2
    FROM
    tableTest t
    fn_whatever(t.col3, t.col4) AS ca

    But the last line gives a syntax error

    Please help if you can
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    7
    Rep Power
    0
    This is the answer I got on another forum in case anyone else ends up asking the same question:

    This is currently not possible.

    Postgres 9.3 will be able to use LATERAL for this (which is the ANSI standard compliant implementation of SQL Server's cross apply).

IMN logo majestic logo threadwatch logo seochat tools logo