VbzCart/docs/coding/integrity checks: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | coding
Jump to navigation Jump to search
imported>Woozle
m (fixed markup tags)
m (Woozle moved page VbzCart/VbzCart/coding/integrity checks to VbzCart/docs/coding/integrity checks without leaving a redirect: correct naming (was no way to import directly to this name))
 
(No difference)

Latest revision as of 01:53, 25 February 2024

Table-specific checks:

Cross-table checks

Package Lines and Order Lines which don't agree about what ID_Item they're tracking:

SELECT 
    *
FROM
    ord_pkg_lines AS pl
        JOIN
    ord_lines AS ol ON pl.ID_OrdLine = ol.ID
WHERE
    ol.ID_Item != pl.ID_Item

Package lines whose Order Line is either not set or nonexistent(!):

SELECT 
    pl.*
FROM
    ord_pkg_lines AS pl
        LEFT JOIN
    ord_lines AS ol ON pl.ID_OrdLine = ol.ID
WHERE
    ol.ID IS NULL