sql server - SQL - Complex Delete with Multiple Linking Tables -


i have sql delete need construct, makes use of complex data structure includes 6 tables:

  • users (userid, etc)
  • catalogs (catalogid, etc)
  • libraries (libraryid, etc)
  • user_catalogs (userid, catalogid)
  • user_libraries (userid, libraryid)
  • catalog_libraries (catalogid, libraryid)

in order make sense of this, business logic follows:

  • a user assigned catalog (user_catalogs); assigns libraries in catalog (catalog_libraries) user (user_libraries)
  • the user can remove libraries don't want view (hense separate linking table, user_libraries)

the problem need solve when catalog deleted, need remove user libraries contained within catalog, not if libraries present in different catalog user has access to.

i've been stuck on while now, greatly appreciated.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -