Search code examples
outsystems

how to write delete query in advance query in outsystems


I am tried to write delete query using advanced query. But don't no how to write query in advance query still I tried but I am getting error.Please help me how to write query with example.

I just want to delete all the data from "EnvelopeHeader" entity.

I got following error


Solution

  • If you're using

    DELETE FROM table
    WHERE table.column IN (...)
    

    That means your inner query must return a list of values with the same type as table.column.

    In your case your inner query:

    1. Is selecting a bunch o columns, and should only be selecting one
    2. When selecting multiple columns you need commas to separate the columns you want to select col1, col2
    3. You need to specify the FROM statement for the inner query

    It should be something like

    DELETE FROM {table}
    WHERE {table}.[column] in
    (SELECT {table}.[column] FROM {table} WHERE <condition>)
    

    Also don't forget that if you want to use parameters, you can refer to them by using @param_name