Options

SQL query in CodeUnit or NAV Query

kenjeskenjes Member Posts: 76
Hi

Is it possible to do something like this in NAV :
;WITH CTE
AS
(
    SELECT DISTINCT
        M1.Product_ID Group_ID,
        M1.Product_ID
    FROM matches M1
        LEFT JOIN matches M2
            ON M1.Product_Id = M2.matching_Product_Id
    WHERE M2.matching_Product_Id IS NULL
    UNION ALL
    SELECT
        C.Group_ID,
        M.matching_Product_Id
    FROM CTE C
        JOIN matches M
            ON C.Product_ID = M.Product_ID
)
SELECT * FROM CTE ORDER BY Group_ID

THANKS

Answers

  • Options
    KishormKishorm Member Posts: 921
    No you cannot write SQL in C/AL and there are limitations as what you can achieve with the Query designer - you wouldn't be able to achieve something like your example above (UNIONS are not supported for example).
Sign In or Register to comment.