Search code examples
sqlmonetdb

Can I retrieve the last insert id in monetdb?


I have been querying for the most recent (auto incrementing) ID of a given table I've inserted into (SELECT "id" FROM "my_table" ORDER BY "id" DESC LIMIT 1), but I'm wondering if there exists a more general way to do this, instead.


Solution

  • Get Column

    SELECT max ("id") FROM "my_table"
    

    Get Row

    Select * from "my table" where "id" in (SELECT max ("id") FROM "my_table")