sql >> Database >  >> RDS >> Oracle

Postgresql en Oracle:update meerdere tabellen van gemeenschappelijke subquery

Iets als:

with recursive menu_tree (id, parent_id) as (
   select id, parent_id
   from menu
   where id = 200
   union all 
   select c.id, c.parent_id
   from menu c
     join menu_tree p on p.id = c.parent_id
)
, deleted_menus (menu_id) as (
   update menu
      set softdel = true
   where id in (select id from menu_tree)
   returning menu.id
),
deleted_pages (page_id) as (
   update page
      set softdel = true
   where menu_id in (select menu_id from deleted_menus)
   returning page.id
),
deleted_articles (article_id) as (
   update article
     set softdel = true
   where page_id in (select page_id from deleted_pages)
)
update article_lang
   set softdel = true
where id in (select article_id from deleted_articles);


  1. Hoe video-inhoud op te slaan in de SQLite-database (niet het videopad)

  2. WAMP virtuele host werkt niet

  3. QMYSQL-stuurprogramma niet geladen op Windows

  4. MYSQL Geo Search met prestaties op afstand