File: check_for_zombie_items.sql

package info (click to toggle)
opendb 0.81p18-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,716 kB
  • ctags: 6,787
  • sloc: php: 50,213; sql: 3,098; sh: 272; makefile: 54; xml: 48
file content (10 lines) | stat: -rw-r--r-- 385 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
#
# Query if any Item records exist without matching Item_Instance (excluding linked items of course)
#
# Since MYSQL 3.23.XX does not support MINUS, we must resort to something a bit more
# messy - but equally effective (but probably not as afficient!)
#
SELECT COUNT(i.id) 
FROM item i
LEFT JOIN item_instance ii ON i.id = ii.item_id
WHERE ii.item_id IS NULL AND i.parent_id IS NULL