-- =====================================================================
-- Read-only pre-flight for migrate_bukanmain_to_63.sql
-- Target: the LIVE bukanmain database (MariaDB 10.4) -- STAGING and PRODUCTION.
-- Generated 2026-08-13, revised 2026-08-13 alongside the corrected migration.
--
-- It only READS. It changes nothing. Safe to run any time, as many times as you want.
-- RUN THIS FIRST, and read the output before running the migration.
--
-- Every check is written so that a CLEAN result prints NOTHING AT ALL -- with two deliberate
-- exceptions in PART 0, which always print, because "no output" is the wrong way to report the
-- setting the whole run depends on.
--
-- PART 0  sql_mode (informational -- the migration sets its own), and the two tables whose
--         new date columns get zero-date filler. ALWAYS PRINTS.
-- PART 0b IDENTITY AND PRE-STATE ASSERTIONS (added 2026-08-14). ALWAYS PRINTS. Every line must
--         say OK. These check that you are pointed at the right database and that the migration
--         has not already been partly applied -- the class of mistake that produced the wrong
--         dump in the first place. Check 7 (`visitplanstatus` populated) and check 8 (any empty
--         RESTRICT parent) guard against silent, irreversible data loss in section 6.
-- PART A  (1272 SELECTs) the 636 foreign-key columns, two checks each:
--
--   zero_sentinel  The column holds 0, the old way of saying "empty / not set". HARMLESS.
--                  The 0 simply becomes NULL, which means the same thing.
--
--   orphan         The column points at a parent row that no longer exists.
--                  *** THIS IS THE ONE TO WORRY ABOUT ***  The migration erases those
--                  values and you cannot get them back. bad_values lists them.
--
-- PART B  the 4 columns the migration USED to drop. It no longer drops anything -- kept as a
--         census so you can see what would have been destroyed.
-- PART C  whether any of the 4 tables section 2 creates ALREADY exists. Any row here
--         means STOP: the CREATE will fail, and something you did not expect made it.
-- PART D  ⚠️ REWRITTEN 2026-08-14 after a real production abort (ERROR 1264 on
--         quotationdetails.UnitPriceIDR). The three decimal(20,2) -> decimal(20,10) conversions
--         it used to cover have been REMOVED from the migration: widening the scale narrows the
--         integer side from 18 digits to 10, and production holds values above 10^10. It is now
--         the census that proves why, plus the precondition for the 63-side migration that
--         replaces them. READ IT -- it is the part that would have caught this in advance.
-- PART E  retired. The column it covered is no longer tightened.
-- PART F  the one-off REPAIR in section 4c -- 863 quotationdetails rows whose
--         QuotationPackID is really a `packing` id. Read it with PART A: those
--         orphans are repaired, not destroyed.
--
-- If the orphan list is short and boring, go ahead. If it shows thousands of orphans in a
-- table you care about, stop and look at it before migrating.
-- =====================================================================

-- ---------------------------------------------------------------------
-- PART 0 - session mode, for the record.  THIS ONE ALWAYS PRINTS.
--
-- This is INFORMATIONAL. The migration no longer depends on the mode it happens to inherit: it
-- COMPUTES its own session mode at the top of the file, forcing STRICT_TRANS_TABLES on and
-- NO_ZERO_DATE / NO_ZERO_IN_DATE off, and restores yours at the end. What is printed here is the
-- mode the AUDIT is reading under, which is worth knowing but does not gate anything.
--
-- Why the migration forces each one, both learned the hard way on 2026-08-13:
--
--   STRICT_TRANS_TABLES ON  -- without it the three decimal(20,2) -> decimal(20,10) conversions
--     in section 3d do not abort on an out-of-range value, they CLAMP. Measured:
--     99999999999.00 became 9999999999.9999999999, silently, with a warning the mysql client
--     never prints. The first run against the real server had a mode of
--     NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION -- no STRICT -- so this was live.
--
--   NO_ZERO_DATE OFF  -- bukanmain was written for years under a non-strict server and its date
--     columns hold '0000-00-00'. With NO_ZERO_DATE set, ANY ALTER that rebuilds such a table
--     re-validates those rows and fails with ERROR 1292 -- every charset conversion, every
--     decimal change, not just the two columns section 3b adds. Measured on a single
--     '0000-00-00' row: a plain latin1 -> utf8mb4 MODIFY aborts with it on, succeeds with it off,
--     and the zero date survives untouched.
--
-- So a strict-less, NO_ZERO_DATE-on server -- which is the normal state here -- is fine. The
-- migration handles it. You do not need to change your server's configuration.
-- ---------------------------------------------------------------------
SELECT @@SQL_MODE AS sql_mode_the_audit_is_reading_under,
       IF(@@SQL_MODE LIKE '%STRICT_TRANS_TABLES%',
          'strict here too - PART D counts below are read the same way the migration will write',
          'not strict here - fine, the migration sets its own mode; PART D counts are still correct'
       ) AS strict_note,
       IF(@@SQL_MODE LIKE '%NO_ZERO_DATE%',
          'NO_ZERO_DATE set here - the migration clears it for its own session, by design',
          'NO_ZERO_DATE not set here'
       ) AS zero_date_note;

SELECT 'purchaseorder' AS tbl, COUNT(*) AS rows_to_be_filled_with_zero_date FROM `purchaseorder`
UNION ALL
SELECT 'users', COUNT(*) FROM `users`;


-- ---------------------------------------------------------------------
-- PART 0b - IDENTITY AND PRE-STATE ASSERTIONS  (NEW 2026-08-14)
-- EVERY CHECK BELOW MUST PRINT `OK`. Any other value means STOP.
--
-- WHY THIS PART EXISTS. The first generation of this migration was built against a dump that
-- had been taken from the WRONG database -- a replica on which `php artisan migrate` had
-- already run. That replica carried 8 tables the real production database does not have, the
-- comparison saw them on both sides, and the migration therefore never created them. The
-- symptom in production was `Base table or view not found: ...sessions`, and it was blamed on
-- the operator rather than on the script.
--
-- Nothing in the old audit could have caught that, because the old audit only checked the
-- things the migration was already planning to touch. These eight assertions check the OPPOSITE:
-- that the database you are pointed at is the shape this script was generated from, and that
-- the script has not already been partly applied. They are cheap, they read only
-- information_schema, and they would each have caught a real mistake that has already happened.
--
-- They are deliberately written against `DATABASE()`, not a hard-coded schema name, so they
-- assert about whatever database you actually connected to -- which is the point.
-- ---------------------------------------------------------------------
SELECT DATABASE() AS you_are_connected_to, VERSION() AS server_version;

-- 1. The 8 Laravel runtime tables MUST BE ABSENT. If any is present, either you are pointed at
--    a database that has already had `php artisan migrate` run against it (the original
--    mistake), or section 2b has already run. Either way the CREATEs in 2b will fail.
SELECT IF(COUNT(*) = 0, 'OK - none of the 8 runtime tables exist yet',
          CONCAT('STOP - ', COUNT(*), ' of the 8 already exist: ', GROUP_CONCAT(TABLE_NAME ORDER BY TABLE_NAME))
       ) AS assert_runtime_tables_absent
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME IN ('cache','cache_locks','failed_jobs','job_batches','jobs','migrations','notification','sessions');

-- 2. `users` MUST still have the lowercase `username` / `password` columns and MUST NOT yet
--    have `Username` / `Password`. Section 3a renames them. MySQL column names are
--    case-insensitive, so a re-run of that CHANGE COLUMN is a no-op rather than an error --
--    which means a half-applied script would NOT announce itself here without this check.
SELECT CONCAT_WS(' ',
         IF(SUM(COLUMN_NAME = 'username' AND BINARY COLUMN_NAME = 'username') = 1, 'OK', 'STOP - users.username (lowercase) not found'),
         IF(SUM(BINARY COLUMN_NAME = 'Otp') = 0, 'OK', 'STOP - users.Otp already exists; section 3b has already run')
       ) AS assert_users_not_yet_renamed
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'users';

-- 3. There MUST be zero foreign keys. bukanmain2 has none at all; section 8 adds 659. A
--    non-zero count means section 8 has already run in whole or in part, and re-running it
--    fails on the first duplicate constraint name -- after sections 3-7 have already
--    re-applied, which is the worst place to discover it.
SELECT IF(COUNT(*) = 0, 'OK - no foreign keys yet',
          CONCAT('STOP - ', COUNT(*), ' foreign keys already exist; section 8 has already run')
       ) AS assert_no_foreign_keys
FROM information_schema.REFERENTIAL_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA = DATABASE();

-- 4. Object census. bukanmain2.sql is 247 base tables + 7 views. A different count does not by
--    itself mean stop -- production may legitimately have drifted -- but it means the diff this
--    script encodes is no longer the diff you are applying, so LOOK before you run.
SELECT IF(SUM(TABLE_TYPE = 'BASE TABLE') = 247 AND SUM(TABLE_TYPE = 'VIEW') = 7,
          'OK - 247 base tables + 7 views, matching bukanmain2.sql',
          CONCAT('LOOK - found ', SUM(TABLE_TYPE = 'BASE TABLE'), ' base tables and ',
                 SUM(TABLE_TYPE = 'VIEW'), ' views; bukanmain2.sql had 247 + 7')
       ) AS assert_object_census
FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE();

-- 5. The three tables that exist ONLY on production must be here. Their presence is the
--    fingerprint of the legacy production schema; their absence means you are pointed at
--    something else (a dev copy, or 63 itself).
SELECT IF(COUNT(*) = 3, 'OK - the 3 production-only tables are present',
          CONCAT('STOP - expected 3 production-only tables, found ', COUNT(*),
                 ' - are you pointed at the right database?')
       ) AS assert_production_fingerprint
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME IN ('salesrebatedetails','salesrebatedetailshistory','salesrebatehistory');

-- 6. The four tables section 2 creates must be absent, and so must the two `quotation`
--    pagination indexes. Same reasoning as check 1.
--    NOTE the indexes are NOT created by this migration -- they are created afterwards by
--    `2026_08_01_100000_add_quotation_list_indexes`, which section 9 deliberately leaves out of
--    the `migrations` seed so that it actually runs. If they already exist here, that migration
--    has already run against this database, which means it is not the virgin production schema.
SELECT IF(COUNT(*) = 0, 'OK - section 2 tables absent',
          CONCAT('STOP - already exist: ', GROUP_CONCAT(TABLE_NAME ORDER BY TABLE_NAME))
       ) AS assert_section2_tables_absent
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME IN ('budgetandtargetachievements','budgetandtargetreal','nsproduct','quotationitemorigin');

SELECT IF(COUNT(DISTINCT INDEX_NAME) = 0, 'OK - quotation pagination indexes absent',
          CONCAT('STOP - already exist: ', GROUP_CONCAT(DISTINCT INDEX_NAME ORDER BY INDEX_NAME))
       ) AS assert_quotation_indexes_absent
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'quotation'
  AND INDEX_NAME IN ('idx_quotation_isdeleted_id','idx_quotation_isdeleted_tanggal_id');

-- 7. 🔥 `visitplanstatus` MUST BE POPULATED BEFORE THIS SCRIPT RUNS. THIS IS THE ONE THAT BITES.
--    Section 6 of the migration NULLs every visit-plan status that does not resolve against
--    `visitplanstatus`, and it runs LONG BEFORE `php artisan migrate` gets a chance to seed that
--    lookup (migration 2026_07_02_134940, deliberately not seeded by section 9). If the lookup
--    is empty when you run the migration, the migration itself erases the statuses, and seeding
--    the lookup afterwards cannot bring them back. Five RESTRICT foreign keys depend on it.
--
--    ⚠ DO NOT LET THIS CHECK TRAIN YOU TO IGNORE IT. Run against a STRUCTURE-ONLY clone it
--    always says STOP, because a structure-only clone has no rows in any table -- the verdict is
--    correct but uninformative there. It is only meaningful against a database WITH DATA, which
--    is the only place you should be reading it anyway. The number it prints is the one that
--    matters: it is how many visit-plan statuses section 6 would erase, and on the real
--    production database it will not be zero.
SELECT IF((SELECT COUNT(*) FROM `visitplanstatus`) > 0,
          CONCAT('OK - visitplanstatus holds ', (SELECT COUNT(*) FROM `visitplanstatus`), ' rows'),
          CONCAT('STOP - visitplanstatus is EMPTY. Section 6 would NULL ',
                 (SELECT COUNT(*) FROM `visitplan`
                   WHERE `VisitPlanStatusID` IS NOT NULL AND `VisitPlanStatusID` <> 0),
                 ' visitplan statuses irreversibly. Seed the lookup FIRST, then re-run this audit.')
       ) AS assert_visitplanstatus_populated;

-- 8. EVERY OTHER LOOKUP BEHIND A RESTRICT KEY - the general form of check 7.  MUST RETURN NOTHING.
--
--    Section 8 attaches 659 RESTRICT foreign keys pointing at 147 distinct parent tables. For
--    each one, section 6 first NULLs any child value that does not resolve. An EMPTY parent
--    therefore means "NULL every child value", silently and irreversibly -- which is exactly the
--    `visitplanstatus` failure, generalised. Any table listed below is a parent that has no rows.
--
--    A row here is not automatically fatal: it is only destructive if children actually hold
--    values pointing at it. Cross-reference PART A, which reports the per-column orphan counts
--    and prints the offending values in `bad_values`. But a row here means STOP AND LOOK.
--
--    The 4 tables section 2 creates are excluded -- they arrive empty by design and are already
--    called out in the migration's own section 2 header.
SELECT 'action' AS empty_parent_table, COUNT(*) AS rows_ FROM `action` HAVING COUNT(*) = 0
UNION ALL
SELECT 'addresstype' AS empty_parent_table, COUNT(*) AS rows_ FROM `addresstype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'application' AS empty_parent_table, COUNT(*) AS rows_ FROM `application` HAVING COUNT(*) = 0
UNION ALL
SELECT 'bank' AS empty_parent_table, COUNT(*) AS rows_ FROM `bank` HAVING COUNT(*) = 0
UNION ALL
SELECT 'barang' AS empty_parent_table, COUNT(*) AS rows_ FROM `barang` HAVING COUNT(*) = 0
UNION ALL
SELECT 'baranglists' AS empty_parent_table, COUNT(*) AS rows_ FROM `baranglists` HAVING COUNT(*) = 0
UNION ALL
SELECT 'barangliststatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `barangliststatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'branch' AS empty_parent_table, COUNT(*) AS rows_ FROM `branch` HAVING COUNT(*) = 0
UNION ALL
SELECT 'budgetandtarget' AS empty_parent_table, COUNT(*) AS rows_ FROM `budgetandtarget` HAVING COUNT(*) = 0
UNION ALL
SELECT 'budgetandtargetperiode' AS empty_parent_table, COUNT(*) AS rows_ FROM `budgetandtargetperiode` HAVING COUNT(*) = 0
UNION ALL
SELECT 'budgetandtargetstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `budgetandtargetstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'category' AS empty_parent_table, COUNT(*) AS rows_ FROM `category` HAVING COUNT(*) = 0
UNION ALL
SELECT 'class' AS empty_parent_table, COUNT(*) AS rows_ FROM `class` HAVING COUNT(*) = 0
UNION ALL
SELECT 'company' AS empty_parent_table, COUNT(*) AS rows_ FROM `company` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companycategory' AS empty_parent_table, COUNT(*) AS rows_ FROM `companycategory` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companycp' AS empty_parent_table, COUNT(*) AS rows_ FROM `companycp` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyproduct' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyproduct` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyproduction' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyproduction` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyproject' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyproject` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyprojectdetailcc' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyprojectdetailcc` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyprojectdetailcomp' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyprojectdetailcomp` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyprojectdetails' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyprojectdetails` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyprojectdetailstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyprojectdetailstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyprojectdetailstatusreason' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyprojectdetailstatusreason` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyprojectopportunitygroup' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyprojectopportunitygroup` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyprojectpriority' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyprojectpriority` HAVING COUNT(*) = 0
UNION ALL
SELECT 'companyprojectstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `companyprojectstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complain' AS empty_parent_table, COUNT(*) AS rows_ FROM `complain` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complaindetails' AS empty_parent_table, COUNT(*) AS rows_ FROM `complaindetails` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complaindetailsaction' AS empty_parent_table, COUNT(*) AS rows_ FROM `complaindetailsaction` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complaindetailsstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `complaindetailsstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complainitem' AS empty_parent_table, COUNT(*) AS rows_ FROM `complainitem` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complainitemdetails' AS empty_parent_table, COUNT(*) AS rows_ FROM `complainitemdetails` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complainitemdetailslot' AS empty_parent_table, COUNT(*) AS rows_ FROM `complainitemdetailslot` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complainitemstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `complainitemstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complainitemtype' AS empty_parent_table, COUNT(*) AS rows_ FROM `complainitemtype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complainreason' AS empty_parent_table, COUNT(*) AS rows_ FROM `complainreason` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complainstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `complainstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complaintosupplier' AS empty_parent_table, COUNT(*) AS rows_ FROM `complaintosupplier` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complaintosupplierstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `complaintosupplierstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complaintosuppliertype' AS empty_parent_table, COUNT(*) AS rows_ FROM `complaintosuppliertype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'complaintype' AS empty_parent_table, COUNT(*) AS rows_ FROM `complaintype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'creditceilingstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `creditceilingstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'delivery' AS empty_parent_table, COUNT(*) AS rows_ FROM `delivery` HAVING COUNT(*) = 0
UNION ALL
SELECT 'department' AS empty_parent_table, COUNT(*) AS rows_ FROM `department` HAVING COUNT(*) = 0
UNION ALL
SELECT 'division' AS empty_parent_table, COUNT(*) AS rows_ FROM `division` HAVING COUNT(*) = 0
UNION ALL
SELECT 'documentcategory' AS empty_parent_table, COUNT(*) AS rows_ FROM `documentcategory` HAVING COUNT(*) = 0
UNION ALL
SELECT 'documentupload' AS empty_parent_table, COUNT(*) AS rows_ FROM `documentupload` HAVING COUNT(*) = 0
UNION ALL
SELECT 'education' AS empty_parent_table, COUNT(*) AS rows_ FROM `education` HAVING COUNT(*) = 0
UNION ALL
SELECT 'gadget' AS empty_parent_table, COUNT(*) AS rows_ FROM `gadget` HAVING COUNT(*) = 0
UNION ALL
SELECT 'groupdivision' AS empty_parent_table, COUNT(*) AS rows_ FROM `groupdivision` HAVING COUNT(*) = 0
UNION ALL
SELECT 'industry' AS empty_parent_table, COUNT(*) AS rows_ FROM `industry` HAVING COUNT(*) = 0
UNION ALL
SELECT 'izin' AS empty_parent_table, COUNT(*) AS rows_ FROM `izin` HAVING COUNT(*) = 0
UNION ALL
SELECT 'izinstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `izinstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'izintype' AS empty_parent_table, COUNT(*) AS rows_ FROM `izintype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'izintypestatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `izintypestatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'justification' AS empty_parent_table, COUNT(*) AS rows_ FROM `justification` HAVING COUNT(*) = 0
UNION ALL
SELECT 'labworkrequest' AS empty_parent_table, COUNT(*) AS rows_ FROM `labworkrequest` HAVING COUNT(*) = 0
UNION ALL
SELECT 'labworkrequestdetails' AS empty_parent_table, COUNT(*) AS rows_ FROM `labworkrequestdetails` HAVING COUNT(*) = 0
UNION ALL
SELECT 'labworkrequestdetailstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `labworkrequestdetailstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'labworkrequestfeedbackstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `labworkrequestfeedbackstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'labworkrequeststatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `labworkrequeststatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'lembur' AS empty_parent_table, COUNT(*) AS rows_ FROM `lembur` HAVING COUNT(*) = 0
UNION ALL
SELECT 'lemburstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `lemburstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'lemburtype' AS empty_parent_table, COUNT(*) AS rows_ FROM `lemburtype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'location' AS empty_parent_table, COUNT(*) AS rows_ FROM `location` HAVING COUNT(*) = 0
UNION ALL
SELECT 'maritalstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `maritalstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'menu' AS empty_parent_table, COUNT(*) AS rows_ FROM `menu` HAVING COUNT(*) = 0
UNION ALL
SELECT 'onleave' AS empty_parent_table, COUNT(*) AS rows_ FROM `onleave` HAVING COUNT(*) = 0
UNION ALL
SELECT 'onleaveadditional' AS empty_parent_table, COUNT(*) AS rows_ FROM `onleaveadditional` HAVING COUNT(*) = 0
UNION ALL
SELECT 'onleavelimit' AS empty_parent_table, COUNT(*) AS rows_ FROM `onleavelimit` HAVING COUNT(*) = 0
UNION ALL
SELECT 'onleavestatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `onleavestatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'packing' AS empty_parent_table, COUNT(*) AS rows_ FROM `packing` HAVING COUNT(*) = 0
UNION ALL
SELECT 'potentialsales' AS empty_parent_table, COUNT(*) AS rows_ FROM `potentialsales` HAVING COUNT(*) = 0
UNION ALL
SELECT 'pricetype' AS empty_parent_table, COUNT(*) AS rows_ FROM `pricetype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'principal' AS empty_parent_table, COUNT(*) AS rows_ FROM `principal` HAVING COUNT(*) = 0
UNION ALL
SELECT 'principalcp' AS empty_parent_table, COUNT(*) AS rows_ FROM `principalcp` HAVING COUNT(*) = 0
UNION ALL
SELECT 'principalfaq' AS empty_parent_table, COUNT(*) AS rows_ FROM `principalfaq` HAVING COUNT(*) = 0
UNION ALL
SELECT 'priority' AS empty_parent_table, COUNT(*) AS rows_ FROM `priority` HAVING COUNT(*) = 0
UNION ALL
SELECT 'product' AS empty_parent_table, COUNT(*) AS rows_ FROM `product` HAVING COUNT(*) = 0
UNION ALL
SELECT 'proposedcreditceiling' AS empty_parent_table, COUNT(*) AS rows_ FROM `proposedcreditceiling` HAVING COUNT(*) = 0
UNION ALL
SELECT 'purchaseorder' AS empty_parent_table, COUNT(*) AS rows_ FROM `purchaseorder` HAVING COUNT(*) = 0
UNION ALL
SELECT 'purchaseorderdetails' AS empty_parent_table, COUNT(*) AS rows_ FROM `purchaseorderdetails` HAVING COUNT(*) = 0
UNION ALL
SELECT 'purchaseorderstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `purchaseorderstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quantitytype' AS empty_parent_table, COUNT(*) AS rows_ FROM `quantitytype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotation' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotation` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationdeliverytime' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationdeliverytime` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationdetails' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationdetails` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationdetailstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationdetailstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationfeedbackstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationfeedbackstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationpack' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationpack` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationpaymentterm' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationpaymentterm` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationpricedesc' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationpricedesc` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationsalesterm' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationsalesterm` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationstockavailability' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationstockavailability` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationsubject' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationsubject` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationtitle' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationtitle` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationtype' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationtype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'quotationvalidity' AS empty_parent_table, COUNT(*) AS rows_ FROM `quotationvalidity` HAVING COUNT(*) = 0
UNION ALL
SELECT 'reference' AS empty_parent_table, COUNT(*) AS rows_ FROM `reference` HAVING COUNT(*) = 0
UNION ALL
SELECT 'role' AS empty_parent_table, COUNT(*) AS rows_ FROM `role` HAVING COUNT(*) = 0
UNION ALL
SELECT 'salesrebate' AS empty_parent_table, COUNT(*) AS rows_ FROM `salesrebate` HAVING COUNT(*) = 0
UNION ALL
SELECT 'salesrebateinvoice' AS empty_parent_table, COUNT(*) AS rows_ FROM `salesrebateinvoice` HAVING COUNT(*) = 0
UNION ALL
SELECT 'salesrebateinvoicedetail' AS empty_parent_table, COUNT(*) AS rows_ FROM `salesrebateinvoicedetail` HAVING COUNT(*) = 0
UNION ALL
SELECT 'salesrebateinvoicedetailstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `salesrebateinvoicedetailstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'salesrebatestatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `salesrebatestatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'sampleorder' AS empty_parent_table, COUNT(*) AS rows_ FROM `sampleorder` HAVING COUNT(*) = 0
UNION ALL
SELECT 'sampleorderby' AS empty_parent_table, COUNT(*) AS rows_ FROM `sampleorderby` HAVING COUNT(*) = 0
UNION ALL
SELECT 'sampleorderdetail' AS empty_parent_table, COUNT(*) AS rows_ FROM `sampleorderdetail` HAVING COUNT(*) = 0
UNION ALL
SELECT 'sampleorderdetailstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `sampleorderdetailstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'sampleorderfeedbackstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `sampleorderfeedbackstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'sampleorderstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `sampleorderstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'samplerequestimport' AS empty_parent_table, COUNT(*) AS rows_ FROM `samplerequestimport` HAVING COUNT(*) = 0
UNION ALL
SELECT 'samplerequestimportdetail' AS empty_parent_table, COUNT(*) AS rows_ FROM `samplerequestimportdetail` HAVING COUNT(*) = 0
UNION ALL
SELECT 'samplerequestimportfrom' AS empty_parent_table, COUNT(*) AS rows_ FROM `samplerequestimportfrom` HAVING COUNT(*) = 0
UNION ALL
SELECT 'samplerequestimportgoodsreceipt' AS empty_parent_table, COUNT(*) AS rows_ FROM `samplerequestimportgoodsreceipt` HAVING COUNT(*) = 0
UNION ALL
SELECT 'samplerequeststatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `samplerequeststatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'satuan' AS empty_parent_table, COUNT(*) AS rows_ FROM `satuan` HAVING COUNT(*) = 0
UNION ALL
SELECT 'specialreference' AS empty_parent_table, COUNT(*) AS rows_ FROM `specialreference` HAVING COUNT(*) = 0
UNION ALL
SELECT 'stockopname' AS empty_parent_table, COUNT(*) AS rows_ FROM `stockopname` HAVING COUNT(*) = 0
UNION ALL
SELECT 'stockopname_principal' AS empty_parent_table, COUNT(*) AS rows_ FROM `stockopname_principal` HAVING COUNT(*) = 0
UNION ALL
SELECT 'stockopname_product' AS empty_parent_table, COUNT(*) AS rows_ FROM `stockopname_product` HAVING COUNT(*) = 0
UNION ALL
SELECT 'stockopnameby' AS empty_parent_table, COUNT(*) AS rows_ FROM `stockopnameby` HAVING COUNT(*) = 0
UNION ALL
SELECT 'stockopnamestatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `stockopnamestatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'successstory' AS empty_parent_table, COUNT(*) AS rows_ FROM `successstory` HAVING COUNT(*) = 0
UNION ALL
SELECT 'suratjalan' AS empty_parent_table, COUNT(*) AS rows_ FROM `suratjalan` HAVING COUNT(*) = 0
UNION ALL
SELECT 'suratjalandetails' AS empty_parent_table, COUNT(*) AS rows_ FROM `suratjalandetails` HAVING COUNT(*) = 0
UNION ALL
SELECT 'type' AS empty_parent_table, COUNT(*) AS rows_ FROM `type` HAVING COUNT(*) = 0
UNION ALL
SELECT 'urgency' AS empty_parent_table, COUNT(*) AS rows_ FROM `urgency` HAVING COUNT(*) = 0
UNION ALL
SELECT 'users' AS empty_parent_table, COUNT(*) AS rows_ FROM `users` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehicle' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehicle` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehiclebrand' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehiclebrand` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehiclebrandtype' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehiclebrandtype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehiclecolor' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehiclecolor` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehiclefueltype' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehiclefueltype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehicleservicerequest' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehicleservicerequest` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehicleservicerequestdetails' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehicleservicerequestdetails` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehicleservicerequeststatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehicleservicerequeststatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehicleservicetype' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehicleservicetype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehiclestatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehiclestatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'vehicletype' AS empty_parent_table, COUNT(*) AS rows_ FROM `vehicletype` HAVING COUNT(*) = 0
UNION ALL
SELECT 'visitplan' AS empty_parent_table, COUNT(*) AS rows_ FROM `visitplan` HAVING COUNT(*) = 0
UNION ALL
SELECT 'visitplandetail' AS empty_parent_table, COUNT(*) AS rows_ FROM `visitplandetail` HAVING COUNT(*) = 0
UNION ALL
SELECT 'visitplanstatus' AS empty_parent_table, COUNT(*) AS rows_ FROM `visitplanstatus` HAVING COUNT(*) = 0
UNION ALL
SELECT 'warehouse' AS empty_parent_table, COUNT(*) AS rows_ FROM `warehouse` HAVING COUNT(*) = 0;

-- ---------------------------------------------------------------------
-- PART A - foreign-key columns (1272 SELECTs)
--
-- ⚠ `group_concat_max_len` IS RAISED FIRST, AND THE AUDIT'S MAIN PROMISE DEPENDS ON IT.
--   `bad_values` is built with GROUP_CONCAT, whose default cap is 1024 BYTES on both MySQL and
--   MariaDB. Measured 2026-08-14: 200 distinct six-digit orphan ids came back cut at exactly
--   1024 bytes -- 146 of 200 survived -- with `Warning 1260: Row 147 was cut by GROUP_CONCAT()`,
--   which the mysql client does not print unless you pass --show-warnings, and which you will
--   not see at all because the documented invocation redirects stdout to a file.
--   That silently defeats the one thing this audit exists to tell you: WHICH values the
--   migration is about to erase. `n` stays correct; the list quietly stops at ~145 ids. The
--   columns most likely to exceed that are exactly the ones where the loss matters most.
--   This SET is the only non-SELECT statement in the file. It is a session variable and reads
--   no data and writes none -- the file is still read-only with respect to your database --
--   but it is a deliberate exception to "1,295 statements, all SELECT", recorded here so that
--   nobody removes it to restore that property.
SET SESSION group_concat_max_len = 1048576;
-- The 4 checks for `reference`.`PaymentTerm` and `referencehistory`.`PaymentTerm` were REMOVED
-- on 2026-08-14. That constraint is wrong in 63 -- the columns hold day counts (60/70/90/180/360),
-- not `quotationpaymentterm` ids -- so it is no longer created and there is nothing to pre-check.
-- Their 151 rows are NOT touched by the migration any more.
-- ---------------------------------------------------------------------
SELECT 'application.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `application` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'application.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `application` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'application.GroupDivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `application` WHERE `GroupDivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'application.GroupDivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`GroupDivisionID` ORDER BY c.`GroupDivisionID`) AS bad_values FROM `application` c LEFT JOIN `groupdivision` p ON c.`GroupDivisionID` = p.`ID` WHERE c.`GroupDivisionID` IS NOT NULL AND c.`GroupDivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'bank.QuotationPriceDescID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `bank` WHERE `QuotationPriceDescID` = 0 HAVING COUNT(*) > 0;
SELECT 'bank.QuotationPriceDescID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationPriceDescID` ORDER BY c.`QuotationPriceDescID`) AS bad_values FROM `bank` c LEFT JOIN `quotationpricedesc` p ON c.`QuotationPriceDescID` = p.`ID` WHERE c.`QuotationPriceDescID` IS NOT NULL AND c.`QuotationPriceDescID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'bankdivision.BankID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `bankdivision` WHERE `BankID` = 0 HAVING COUNT(*) > 0;
SELECT 'bankdivision.BankID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BankID` ORDER BY c.`BankID`) AS bad_values FROM `bankdivision` c LEFT JOIN `bank` p ON c.`BankID` = p.`ID` WHERE c.`BankID` IS NOT NULL AND c.`BankID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'bankdivision.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `bankdivision` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'bankdivision.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `bankdivision` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'barang.CategoryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `barang` WHERE `CategoryID` = 0 HAVING COUNT(*) > 0;
SELECT 'barang.CategoryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CategoryID` ORDER BY c.`CategoryID`) AS bad_values FROM `barang` c LEFT JOIN `category` p ON c.`CategoryID` = p.`ID` WHERE c.`CategoryID` IS NOT NULL AND c.`CategoryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'barang.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `barang` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'barang.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `barang` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'barang.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `barang` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'barang.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `barang` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'barang.TypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `barang` WHERE `TypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'barang.TypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`TypeID` ORDER BY c.`TypeID`) AS bad_values FROM `barang` c LEFT JOIN `type` p ON c.`TypeID` = p.`ID` WHERE c.`TypeID` IS NOT NULL AND c.`TypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'baranglist.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `baranglist` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'baranglist.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `baranglist` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'baranglist.BarangListStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `baranglist` WHERE `BarangListStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'baranglist.BarangListStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangListStatusID` ORDER BY c.`BarangListStatusID`) AS bad_values FROM `baranglist` c LEFT JOIN `barangliststatus` p ON c.`BarangListStatusID` = p.`ID` WHERE c.`BarangListStatusID` IS NOT NULL AND c.`BarangListStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'baranglist.SampleOrderDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `baranglist` WHERE `SampleOrderDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'baranglist.SampleOrderDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderDetailID` ORDER BY c.`SampleOrderDetailID`) AS bad_values FROM `baranglist` c LEFT JOIN `sampleorderdetail` p ON c.`SampleOrderDetailID` = p.`ID` WHERE c.`SampleOrderDetailID` IS NOT NULL AND c.`SampleOrderDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'baranglist.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `baranglist` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'baranglist.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `baranglist` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'baranglists.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `baranglists` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'baranglists.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `baranglists` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'baranglists.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `baranglists` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'baranglists.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `baranglists` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'barangstockmin.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `barangstockmin` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'barangstockmin.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `barangstockmin` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'barangstockmin.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `barangstockmin` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'barangstockmin.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `barangstockmin` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.BudgetAndTargetPeriodeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtarget` WHERE `BudgetAndTargetPeriodeID` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.BudgetAndTargetPeriodeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BudgetAndTargetPeriodeID` ORDER BY c.`BudgetAndTargetPeriodeID`) AS bad_values FROM `budgetandtarget` c LEFT JOIN `budgetandtargetperiode` p ON c.`BudgetAndTargetPeriodeID` = p.`ID` WHERE c.`BudgetAndTargetPeriodeID` IS NOT NULL AND c.`BudgetAndTargetPeriodeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.BudgetAndTargetStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtarget` WHERE `BudgetAndTargetStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.BudgetAndTargetStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BudgetAndTargetStatusID` ORDER BY c.`BudgetAndTargetStatusID`) AS bad_values FROM `budgetandtarget` c LEFT JOIN `budgetandtargetstatus` p ON c.`BudgetAndTargetStatusID` = p.`ID` WHERE c.`BudgetAndTargetStatusID` IS NOT NULL AND c.`BudgetAndTargetStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtarget` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `budgetandtarget` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtarget` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `budgetandtarget` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtarget` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `budgetandtarget` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtarget` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `budgetandtarget` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtarget` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtarget.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `budgetandtarget` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtargetassignment.BudgetAndTargetID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtargetassignment` WHERE `BudgetAndTargetID` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtargetassignment.BudgetAndTargetID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BudgetAndTargetID` ORDER BY c.`BudgetAndTargetID`) AS bad_values FROM `budgetandtargetassignment` c LEFT JOIN `budgetandtarget` p ON c.`BudgetAndTargetID` = p.`ID` WHERE c.`BudgetAndTargetID` IS NOT NULL AND c.`BudgetAndTargetID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtargetassignment.BudgetAndTargetStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtargetassignment` WHERE `BudgetAndTargetStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtargetassignment.BudgetAndTargetStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BudgetAndTargetStatusID` ORDER BY c.`BudgetAndTargetStatusID`) AS bad_values FROM `budgetandtargetassignment` c LEFT JOIN `budgetandtargetstatus` p ON c.`BudgetAndTargetStatusID` = p.`ID` WHERE c.`BudgetAndTargetStatusID` IS NOT NULL AND c.`BudgetAndTargetStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'budgetandtargetassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `budgetandtargetassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'budgetandtargetassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `budgetandtargetassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'comissionpercentage.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `comissionpercentage` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'comissionpercentage.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `comissionpercentage` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'company.BranchID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `company` WHERE `BranchID` = 0 HAVING COUNT(*) > 0;
SELECT 'company.BranchID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BranchID` ORDER BY c.`BranchID`) AS bad_values FROM `company` c LEFT JOIN `branch` p ON c.`BranchID` = p.`ID` WHERE c.`BranchID` IS NOT NULL AND c.`BranchID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'company.CompanyCategoryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `company` WHERE `CompanyCategoryID` = 0 HAVING COUNT(*) > 0;
SELECT 'company.CompanyCategoryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCategoryID` ORDER BY c.`CompanyCategoryID`) AS bad_values FROM `company` c LEFT JOIN `companycategory` p ON c.`CompanyCategoryID` = p.`ID` WHERE c.`CompanyCategoryID` IS NOT NULL AND c.`CompanyCategoryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'company.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `company` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'company.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `company` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'company.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `company` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'company.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `company` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'company.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `company` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'company.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `company` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyaccessothers.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyaccessothers` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyaccessothers.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyaccessothers` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyaccessothers.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyaccessothers` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyaccessothers.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `companyaccessothers` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycategory.GroupDivID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycategory` WHERE `GroupDivID` = 0 HAVING COUNT(*) > 0;
SELECT 'companycategory.GroupDivID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`GroupDivID` ORDER BY c.`GroupDivID`) AS bad_values FROM `companycategory` c LEFT JOIN `groupdivision` p ON c.`GroupDivID` = p.`ID` WHERE c.`GroupDivID` IS NOT NULL AND c.`GroupDivID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycategorylist.CompanyCategoryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycategorylist` WHERE `CompanyCategoryID` = 0 HAVING COUNT(*) > 0;
SELECT 'companycategorylist.CompanyCategoryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCategoryID` ORDER BY c.`CompanyCategoryID`) AS bad_values FROM `companycategorylist` c LEFT JOIN `companycategory` p ON c.`CompanyCategoryID` = p.`ID` WHERE c.`CompanyCategoryID` IS NOT NULL AND c.`CompanyCategoryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycategorylist.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycategorylist` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companycategorylist.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companycategorylist` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycp.AddressType' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycp` WHERE `AddressType` = 0 HAVING COUNT(*) > 0;
SELECT 'companycp.AddressType' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`AddressType` ORDER BY c.`AddressType`) AS bad_values FROM `companycp` c LEFT JOIN `addresstype` p ON c.`AddressType` = p.`ID` WHERE c.`AddressType` IS NOT NULL AND c.`AddressType` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycp.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycp` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companycp.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companycp` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycpassignment.AddressType' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycpassignment` WHERE `AddressType` = 0 HAVING COUNT(*) > 0;
SELECT 'companycpassignment.AddressType' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`AddressType` ORDER BY c.`AddressType`) AS bad_values FROM `companycpassignment` c LEFT JOIN `addresstype` p ON c.`AddressType` = p.`ID` WHERE c.`AddressType` IS NOT NULL AND c.`AddressType` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycpassignment.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycpassignment` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'companycpassignment.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `companycpassignment` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycpassignment.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycpassignment` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companycpassignment.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companycpassignment` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companycpassignment.UsersID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companycpassignment` WHERE `UsersID` = 0 HAVING COUNT(*) > 0;
SELECT 'companycpassignment.UsersID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UsersID` ORDER BY c.`UsersID`) AS bad_values FROM `companycpassignment` c LEFT JOIN `users` p ON c.`UsersID` = p.`ID` WHERE c.`UsersID` IS NOT NULL AND c.`UsersID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyhistory.BranchID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyhistory` WHERE `BranchID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyhistory.BranchID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BranchID` ORDER BY c.`BranchID`) AS bad_values FROM `companyhistory` c LEFT JOIN `branch` p ON c.`BranchID` = p.`ID` WHERE c.`BranchID` IS NOT NULL AND c.`BranchID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyhistory.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyhistory` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyhistory.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyhistory` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyhistory.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyhistory` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyhistory.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `companyhistory` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyhistory.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyhistory` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyhistory.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `companyhistory` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyhistory.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyhistory` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'companyhistory.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `companyhistory` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyindustry.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyindustry` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyindustry.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyindustry` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyindustry.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyindustry` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyindustry.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `companyindustry` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `companyproduct` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CCBarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CCBarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CCBarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCBarangID` ORDER BY c.`CCBarangID`) AS bad_values FROM `companyproduct` c LEFT JOIN `barang` p ON c.`CCBarangID` = p.`ID` WHERE c.`CCBarangID` IS NOT NULL AND c.`CCBarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CCPriceSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CCPriceSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CCPriceSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCPriceSatuanID` ORDER BY c.`CCPriceSatuanID`) AS bad_values FROM `companyproduct` c LEFT JOIN `satuan` p ON c.`CCPriceSatuanID` = p.`ID` WHERE c.`CCPriceSatuanID` IS NOT NULL AND c.`CCPriceSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CCPrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CCPrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CCPrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCPrincipalID` ORDER BY c.`CCPrincipalID`) AS bad_values FROM `companyproduct` c LEFT JOIN `principal` p ON c.`CCPrincipalID` = p.`ID` WHERE c.`CCPrincipalID` IS NOT NULL AND c.`CCPrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CCVolumeSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CCVolumeSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CCVolumeSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCVolumeSatuanID` ORDER BY c.`CCVolumeSatuanID`) AS bad_values FROM `companyproduct` c LEFT JOIN `satuan` p ON c.`CCVolumeSatuanID` = p.`ID` WHERE c.`CCVolumeSatuanID` IS NOT NULL AND c.`CCVolumeSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyproduct` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompetitorBarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CompetitorBarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompetitorBarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompetitorBarangID` ORDER BY c.`CompetitorBarangID`) AS bad_values FROM `companyproduct` c LEFT JOIN `barang` p ON c.`CompetitorBarangID` = p.`ID` WHERE c.`CompetitorBarangID` IS NOT NULL AND c.`CompetitorBarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompetitorPriceSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CompetitorPriceSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompetitorPriceSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompetitorPriceSatuanID` ORDER BY c.`CompetitorPriceSatuanID`) AS bad_values FROM `companyproduct` c LEFT JOIN `satuan` p ON c.`CompetitorPriceSatuanID` = p.`ID` WHERE c.`CompetitorPriceSatuanID` IS NOT NULL AND c.`CompetitorPriceSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompetitorPrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CompetitorPrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompetitorPrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompetitorPrincipalID` ORDER BY c.`CompetitorPrincipalID`) AS bad_values FROM `companyproduct` c LEFT JOIN `principal` p ON c.`CompetitorPrincipalID` = p.`ID` WHERE c.`CompetitorPrincipalID` IS NOT NULL AND c.`CompetitorPrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompetitorVolumeSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `CompetitorVolumeSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.CompetitorVolumeSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompetitorVolumeSatuanID` ORDER BY c.`CompetitorVolumeSatuanID`) AS bad_values FROM `companyproduct` c LEFT JOIN `satuan` p ON c.`CompetitorVolumeSatuanID` = p.`ID` WHERE c.`CompetitorVolumeSatuanID` IS NOT NULL AND c.`CompetitorVolumeSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduct.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduct` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduct.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `companyproduct` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductapplication.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductapplication` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductapplication.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyproductapplication` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductapplication.ProductApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductapplication` WHERE `ProductApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductapplication.ProductApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductApplicationID` ORDER BY c.`ProductApplicationID`) AS bad_values FROM `companyproductapplication` c LEFT JOIN `application` p ON c.`ProductApplicationID` = p.`ID` WHERE c.`ProductApplicationID` IS NOT NULL AND c.`ProductApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CCBarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CCBarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CCBarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCBarangID` ORDER BY c.`CCBarangID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `barang` p ON c.`CCBarangID` = p.`ID` WHERE c.`CCBarangID` IS NOT NULL AND c.`CCBarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CCPriceSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CCPriceSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CCPriceSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCPriceSatuanID` ORDER BY c.`CCPriceSatuanID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `satuan` p ON c.`CCPriceSatuanID` = p.`ID` WHERE c.`CCPriceSatuanID` IS NOT NULL AND c.`CCPriceSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CCPrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CCPrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CCPrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCPrincipalID` ORDER BY c.`CCPrincipalID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `principal` p ON c.`CCPrincipalID` = p.`ID` WHERE c.`CCPrincipalID` IS NOT NULL AND c.`CCPrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CCVolumeSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CCVolumeSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CCVolumeSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCVolumeSatuanID` ORDER BY c.`CCVolumeSatuanID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `satuan` p ON c.`CCVolumeSatuanID` = p.`ID` WHERE c.`CCVolumeSatuanID` IS NOT NULL AND c.`CCVolumeSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompanyProductID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CompanyProductID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompanyProductID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProductID` ORDER BY c.`CompanyProductID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `companyproduct` p ON c.`CompanyProductID` = p.`ID` WHERE c.`CompanyProductID` IS NOT NULL AND c.`CompanyProductID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompetitorBarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CompetitorBarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompetitorBarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompetitorBarangID` ORDER BY c.`CompetitorBarangID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `barang` p ON c.`CompetitorBarangID` = p.`ID` WHERE c.`CompetitorBarangID` IS NOT NULL AND c.`CompetitorBarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompetitorPriceSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CompetitorPriceSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompetitorPriceSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompetitorPriceSatuanID` ORDER BY c.`CompetitorPriceSatuanID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `satuan` p ON c.`CompetitorPriceSatuanID` = p.`ID` WHERE c.`CompetitorPriceSatuanID` IS NOT NULL AND c.`CompetitorPriceSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompetitorPrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CompetitorPrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompetitorPrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompetitorPrincipalID` ORDER BY c.`CompetitorPrincipalID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `principal` p ON c.`CompetitorPrincipalID` = p.`ID` WHERE c.`CompetitorPrincipalID` IS NOT NULL AND c.`CompetitorPrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompetitorVolumeSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `CompetitorVolumeSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.CompetitorVolumeSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompetitorVolumeSatuanID` ORDER BY c.`CompetitorVolumeSatuanID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `satuan` p ON c.`CompetitorVolumeSatuanID` = p.`ID` WHERE c.`CompetitorVolumeSatuanID` IS NOT NULL AND c.`CompetitorVolumeSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.UsersID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductassignment` WHERE `UsersID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductassignment.UsersID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UsersID` ORDER BY c.`UsersID`) AS bad_values FROM `companyproductassignment` c LEFT JOIN `users` p ON c.`UsersID` = p.`ID` WHERE c.`UsersID` IS NOT NULL AND c.`UsersID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductcategory.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductcategory` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductcategory.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyproductcategory` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductcategory.ProductCategoryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductcategory` WHERE `ProductCategoryID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductcategory.ProductCategoryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductCategoryID` ORDER BY c.`ProductCategoryID`) AS bad_values FROM `companyproductcategory` c LEFT JOIN `category` p ON c.`ProductCategoryID` = p.`ID` WHERE c.`ProductCategoryID` IS NOT NULL AND c.`ProductCategoryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduction.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduction` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduction.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `companyproduction` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduction.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduction` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduction.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyproduction` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduction.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduction` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduction.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `companyproduction` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproduction.VolumeSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproduction` WHERE `VolumeSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproduction.VolumeSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VolumeSatuanID` ORDER BY c.`VolumeSatuanID`) AS bad_values FROM `companyproduction` c LEFT JOIN `satuan` p ON c.`VolumeSatuanID` = p.`ID` WHERE c.`VolumeSatuanID` IS NOT NULL AND c.`VolumeSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductionassignment` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `companyproductionassignment` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductionassignment` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyproductionassignment` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.CompanyProductionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductionassignment` WHERE `CompanyProductionID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.CompanyProductionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProductionID` ORDER BY c.`CompanyProductionID`) AS bad_values FROM `companyproductionassignment` c LEFT JOIN `companyproduction` p ON c.`CompanyProductionID` = p.`ID` WHERE c.`CompanyProductionID` IS NOT NULL AND c.`CompanyProductionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductionassignment` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `companyproductionassignment` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.UsersID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductionassignment` WHERE `UsersID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.UsersID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UsersID` ORDER BY c.`UsersID`) AS bad_values FROM `companyproductionassignment` c LEFT JOIN `users` p ON c.`UsersID` = p.`ID` WHERE c.`UsersID` IS NOT NULL AND c.`UsersID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.VolumeSatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproductionassignment` WHERE `VolumeSatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproductionassignment.VolumeSatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VolumeSatuanID` ORDER BY c.`VolumeSatuanID`) AS bad_values FROM `companyproductionassignment` c LEFT JOIN `satuan` p ON c.`VolumeSatuanID` = p.`ID` WHERE c.`VolumeSatuanID` IS NOT NULL AND c.`VolumeSatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.CompanyCP' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `CompanyCP` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.CompanyCP' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCP` ORDER BY c.`CompanyCP`) AS bad_values FROM `companyproject` c LEFT JOIN `companycp` p ON c.`CompanyCP` = p.`ID` WHERE c.`CompanyCP` IS NOT NULL AND c.`CompanyCP` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyproject` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `companyproject` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `companyproject` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `companyproject` c LEFT JOIN `companyproject` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.ProjectPriority' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `ProjectPriority` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.ProjectPriority' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectPriority` ORDER BY c.`ProjectPriority`) AS bad_values FROM `companyproject` c LEFT JOIN `companyprojectpriority` p ON c.`ProjectPriority` = p.`ID` WHERE c.`ProjectPriority` IS NOT NULL AND c.`ProjectPriority` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.ProjectStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `ProjectStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.ProjectStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectStatusID` ORDER BY c.`ProjectStatusID`) AS bad_values FROM `companyproject` c LEFT JOIN `companyprojectstatus` p ON c.`ProjectStatusID` = p.`ID` WHERE c.`ProjectStatusID` IS NOT NULL AND c.`ProjectStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `companyproject` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyproject.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyproject` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'companyproject.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `companyproject` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.CompanyProjectDetailCCID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectassignment` WHERE `CompanyProjectDetailCCID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.CompanyProjectDetailCCID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectDetailCCID` ORDER BY c.`CompanyProjectDetailCCID`) AS bad_values FROM `companyprojectassignment` c LEFT JOIN `companyprojectdetailcc` p ON c.`CompanyProjectDetailCCID` = p.`ID` WHERE c.`CompanyProjectDetailCCID` IS NOT NULL AND c.`CompanyProjectDetailCCID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.CompanyProjectDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectassignment` WHERE `CompanyProjectDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.CompanyProjectDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectDetailID` ORDER BY c.`CompanyProjectDetailID`) AS bad_values FROM `companyprojectassignment` c LEFT JOIN `companyprojectdetails` p ON c.`CompanyProjectDetailID` = p.`ID` WHERE c.`CompanyProjectDetailID` IS NOT NULL AND c.`CompanyProjectDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectassignment` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectassignment` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.ProjectStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectassignment` WHERE `ProjectStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.ProjectStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectStatusID` ORDER BY c.`ProjectStatusID`) AS bad_values FROM `companyprojectassignment` c LEFT JOIN `companyprojectstatus` p ON c.`ProjectStatusID` = p.`ID` WHERE c.`ProjectStatusID` IS NOT NULL AND c.`ProjectStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `companyprojectassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.DetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `DetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.DetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailID` ORDER BY c.`DetailID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `companyprojectdetails` p ON c.`DetailID` = p.`ID` WHERE c.`DetailID` IS NOT NULL AND c.`DetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.ItemReasonID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `ItemReasonID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.ItemReasonID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ItemReasonID` ORDER BY c.`ItemReasonID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `companyprojectdetailstatusreason` p ON c.`ItemReasonID` = p.`ID` WHERE c.`ItemReasonID` IS NOT NULL AND c.`ItemReasonID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.ItemStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `ItemStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.ItemStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ItemStatusID` ORDER BY c.`ItemStatusID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `companyprojectdetailstatus` p ON c.`ItemStatusID` = p.`ID` WHERE c.`ItemStatusID` IS NOT NULL AND c.`ItemStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.PriceTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `PriceTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.PriceTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PriceTypeID` ORDER BY c.`PriceTypeID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `pricetype` p ON c.`PriceTypeID` = p.`ID` WHERE c.`PriceTypeID` IS NOT NULL AND c.`PriceTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.ProductID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `ProductID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.ProductID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductID` ORDER BY c.`ProductID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `barang` p ON c.`ProductID` = p.`ID` WHERE c.`ProductID` IS NOT NULL AND c.`ProductID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.ProjectStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `ProjectStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.ProjectStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectStatusID` ORDER BY c.`ProjectStatusID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `companyprojectstatus` p ON c.`ProjectStatusID` = p.`ID` WHERE c.`ProjectStatusID` IS NOT NULL AND c.`ProjectStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.QtTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `QtTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.QtTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QtTypeID` ORDER BY c.`QtTypeID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `quantitytype` p ON c.`QtTypeID` = p.`ID` WHERE c.`QtTypeID` IS NOT NULL AND c.`QtTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcc` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcc.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `companyprojectdetailcc` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.DetailCCID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `DetailCCID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.DetailCCID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailCCID` ORDER BY c.`DetailCCID`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `companyprojectdetailcc` p ON c.`DetailCCID` = p.`ID` WHERE c.`DetailCCID` IS NOT NULL AND c.`DetailCCID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.DetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `DetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.DetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailID` ORDER BY c.`DetailID`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `companyprojectdetails` p ON c.`DetailID` = p.`ID` WHERE c.`DetailID` IS NOT NULL AND c.`DetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.PriceTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `PriceTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.PriceTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PriceTypeID` ORDER BY c.`PriceTypeID`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `pricetype` p ON c.`PriceTypeID` = p.`ID` WHERE c.`PriceTypeID` IS NOT NULL AND c.`PriceTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.ProductID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `ProductID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.ProductID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductID` ORDER BY c.`ProductID`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `barang` p ON c.`ProductID` = p.`ID` WHERE c.`ProductID` IS NOT NULL AND c.`ProductID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.QtTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `QtTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.QtTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QtTypeID` ORDER BY c.`QtTypeID`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `quantitytype` p ON c.`QtTypeID` = p.`ID` WHERE c.`QtTypeID` IS NOT NULL AND c.`QtTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailccassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailccassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `companyprojectdetailccassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcomp` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectdetailcomp` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.DetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcomp` WHERE `DetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.DetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailID` ORDER BY c.`DetailID`) AS bad_values FROM `companyprojectdetailcomp` c LEFT JOIN `companyprojectdetails` p ON c.`DetailID` = p.`ID` WHERE c.`DetailID` IS NOT NULL AND c.`DetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.PriceTypeIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcomp` WHERE `PriceTypeIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.PriceTypeIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PriceTypeIDComp` ORDER BY c.`PriceTypeIDComp`) AS bad_values FROM `companyprojectdetailcomp` c LEFT JOIN `pricetype` p ON c.`PriceTypeIDComp` = p.`ID` WHERE c.`PriceTypeIDComp` IS NOT NULL AND c.`PriceTypeIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.PrincipalIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcomp` WHERE `PrincipalIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.PrincipalIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalIDComp` ORDER BY c.`PrincipalIDComp`) AS bad_values FROM `companyprojectdetailcomp` c LEFT JOIN `principal` p ON c.`PrincipalIDComp` = p.`ID` WHERE c.`PrincipalIDComp` IS NOT NULL AND c.`PrincipalIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.ProductIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcomp` WHERE `ProductIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.ProductIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductIDComp` ORDER BY c.`ProductIDComp`) AS bad_values FROM `companyprojectdetailcomp` c LEFT JOIN `barang` p ON c.`ProductIDComp` = p.`ID` WHERE c.`ProductIDComp` IS NOT NULL AND c.`ProductIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.QtTypeIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcomp` WHERE `QtTypeIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.QtTypeIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QtTypeIDComp` ORDER BY c.`QtTypeIDComp`) AS bad_values FROM `companyprojectdetailcomp` c LEFT JOIN `quantitytype` p ON c.`QtTypeIDComp` = p.`ID` WHERE c.`QtTypeIDComp` IS NOT NULL AND c.`QtTypeIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.SatuanIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcomp` WHERE `SatuanIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcomp.SatuanIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanIDComp` ORDER BY c.`SatuanIDComp`) AS bad_values FROM `companyprojectdetailcomp` c LEFT JOIN `satuan` p ON c.`SatuanIDComp` = p.`ID` WHERE c.`SatuanIDComp` IS NOT NULL AND c.`SatuanIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.DetailCompID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `DetailCompID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.DetailCompID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailCompID` ORDER BY c.`DetailCompID`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `companyprojectdetailcomp` p ON c.`DetailCompID` = p.`ID` WHERE c.`DetailCompID` IS NOT NULL AND c.`DetailCompID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.DetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `DetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.DetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailID` ORDER BY c.`DetailID`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `companyprojectdetails` p ON c.`DetailID` = p.`ID` WHERE c.`DetailID` IS NOT NULL AND c.`DetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.PriceTypeIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `PriceTypeIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.PriceTypeIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PriceTypeIDComp` ORDER BY c.`PriceTypeIDComp`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `pricetype` p ON c.`PriceTypeIDComp` = p.`ID` WHERE c.`PriceTypeIDComp` IS NOT NULL AND c.`PriceTypeIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.PrincipalIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `PrincipalIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.PrincipalIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalIDComp` ORDER BY c.`PrincipalIDComp`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `principal` p ON c.`PrincipalIDComp` = p.`ID` WHERE c.`PrincipalIDComp` IS NOT NULL AND c.`PrincipalIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.ProductIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `ProductIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.ProductIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductIDComp` ORDER BY c.`ProductIDComp`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `barang` p ON c.`ProductIDComp` = p.`ID` WHERE c.`ProductIDComp` IS NOT NULL AND c.`ProductIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.QtTypeIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `QtTypeIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.QtTypeIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QtTypeIDComp` ORDER BY c.`QtTypeIDComp`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `quantitytype` p ON c.`QtTypeIDComp` = p.`ID` WHERE c.`QtTypeIDComp` IS NOT NULL AND c.`QtTypeIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.SatuanIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `SatuanIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.SatuanIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanIDComp` ORDER BY c.`SatuanIDComp`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `satuan` p ON c.`SatuanIDComp` = p.`ID` WHERE c.`SatuanIDComp` IS NOT NULL AND c.`SatuanIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailcompassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailcompassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `companyprojectdetailcompassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetails.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetails` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetails.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `companyprojectdetails` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetails.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetails` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetails.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectdetails` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetails.OpportunityGroupID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetails` WHERE `OpportunityGroupID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetails.OpportunityGroupID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`OpportunityGroupID` ORDER BY c.`OpportunityGroupID`) AS bad_values FROM `companyprojectdetails` c LEFT JOIN `companyprojectopportunitygroup` p ON c.`OpportunityGroupID` = p.`ID` WHERE c.`OpportunityGroupID` IS NOT NULL AND c.`OpportunityGroupID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetails.ProjectStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetails` WHERE `ProjectStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetails.ProjectStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectStatusID` ORDER BY c.`ProjectStatusID`) AS bad_values FROM `companyprojectdetails` c LEFT JOIN `companyprojectstatus` p ON c.`ProjectStatusID` = p.`ID` WHERE c.`ProjectStatusID` IS NOT NULL AND c.`ProjectStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailsassignment` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `companyprojectdetailsassignment` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailsassignment` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectdetailsassignment` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.DetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailsassignment` WHERE `DetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.DetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailID` ORDER BY c.`DetailID`) AS bad_values FROM `companyprojectdetailsassignment` c LEFT JOIN `companyprojectdetails` p ON c.`DetailID` = p.`ID` WHERE c.`DetailID` IS NOT NULL AND c.`DetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.OpportunityGroupID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailsassignment` WHERE `OpportunityGroupID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.OpportunityGroupID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`OpportunityGroupID` ORDER BY c.`OpportunityGroupID`) AS bad_values FROM `companyprojectdetailsassignment` c LEFT JOIN `companyprojectopportunitygroup` p ON c.`OpportunityGroupID` = p.`ID` WHERE c.`OpportunityGroupID` IS NOT NULL AND c.`OpportunityGroupID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailsassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailsassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `companyprojectdetailsassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailstatusassignment` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectdetailstatusassignment` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.DetailCCID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailstatusassignment` WHERE `DetailCCID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.DetailCCID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailCCID` ORDER BY c.`DetailCCID`) AS bad_values FROM `companyprojectdetailstatusassignment` c LEFT JOIN `companyprojectdetailcc` p ON c.`DetailCCID` = p.`ID` WHERE c.`DetailCCID` IS NOT NULL AND c.`DetailCCID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.DetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailstatusassignment` WHERE `DetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.DetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DetailID` ORDER BY c.`DetailID`) AS bad_values FROM `companyprojectdetailstatusassignment` c LEFT JOIN `companyprojectdetails` p ON c.`DetailID` = p.`ID` WHERE c.`DetailID` IS NOT NULL AND c.`DetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.ItemReasonID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailstatusassignment` WHERE `ItemReasonID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.ItemReasonID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ItemReasonID` ORDER BY c.`ItemReasonID`) AS bad_values FROM `companyprojectdetailstatusassignment` c LEFT JOIN `companyprojectdetailstatusreason` p ON c.`ItemReasonID` = p.`ID` WHERE c.`ItemReasonID` IS NOT NULL AND c.`ItemReasonID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.ItemStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailstatusassignment` WHERE `ItemStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.ItemStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ItemStatusID` ORDER BY c.`ItemStatusID`) AS bad_values FROM `companyprojectdetailstatusassignment` c LEFT JOIN `companyprojectdetailstatus` p ON c.`ItemStatusID` = p.`ID` WHERE c.`ItemStatusID` IS NOT NULL AND c.`ItemStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.ProjectStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailstatusassignment` WHERE `ProjectStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.ProjectStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectStatusID` ORDER BY c.`ProjectStatusID`) AS bad_values FROM `companyprojectdetailstatusassignment` c LEFT JOIN `companyprojectstatus` p ON c.`ProjectStatusID` = p.`ID` WHERE c.`ProjectStatusID` IS NOT NULL AND c.`ProjectStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailstatusassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `companyprojectdetailstatusassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusreason.StatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectdetailstatusreason` WHERE `StatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectdetailstatusreason.StatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`StatusID` ORDER BY c.`StatusID`) AS bad_values FROM `companyprojectdetailstatusreason` c LEFT JOIN `companyprojectdetailstatus` p ON c.`StatusID` = p.`ID` WHERE c.`StatusID` IS NOT NULL AND c.`StatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.CompanyCP' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `CompanyCP` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.CompanyCP' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCP` ORDER BY c.`CompanyCP`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `companycp` p ON c.`CompanyCP` = p.`ID` WHERE c.`CompanyCP` IS NOT NULL AND c.`CompanyCP` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.CompanyProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `CompanyProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.CompanyProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyProjectID` ORDER BY c.`CompanyProjectID`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `companyproject` p ON c.`CompanyProjectID` = p.`ID` WHERE c.`CompanyProjectID` IS NOT NULL AND c.`CompanyProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `companyproject` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.ProjectPriority' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `ProjectPriority` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.ProjectPriority' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectPriority` ORDER BY c.`ProjectPriority`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `companyprojectpriority` p ON c.`ProjectPriority` = p.`ID` WHERE c.`ProjectPriority` IS NOT NULL AND c.`ProjectPriority` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `companyprojectheaderassignment` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'companyprojectheaderassignment.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `companyprojectheaderassignment` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complain.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complain` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'complain.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `complain` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complain.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complain` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'complain.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `complain` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complain.ComplainReasonID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complain` WHERE `ComplainReasonID` = 0 HAVING COUNT(*) > 0;
SELECT 'complain.ComplainReasonID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainReasonID` ORDER BY c.`ComplainReasonID`) AS bad_values FROM `complain` c LEFT JOIN `complainreason` p ON c.`ComplainReasonID` = p.`ID` WHERE c.`ComplainReasonID` IS NOT NULL AND c.`ComplainReasonID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complain.ComplainStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complain` WHERE `ComplainStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complain.ComplainStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainStatusID` ORDER BY c.`ComplainStatusID`) AS bad_values FROM `complain` c LEFT JOIN `complainstatus` p ON c.`ComplainStatusID` = p.`ID` WHERE c.`ComplainStatusID` IS NOT NULL AND c.`ComplainStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complain.ComplainTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complain` WHERE `ComplainTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'complain.ComplainTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainTypeID` ORDER BY c.`ComplainTypeID`) AS bad_values FROM `complain` c LEFT JOIN `complaintype` p ON c.`ComplainTypeID` = p.`ID` WHERE c.`ComplainTypeID` IS NOT NULL AND c.`ComplainTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complain.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complain` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'complain.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `complain` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complain.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complain` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complain.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complain` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complain.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complain` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'complain.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `complain` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainassignment.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainassignment` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainassignment.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complainassignment` c LEFT JOIN `complain` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainassignment.ComplainStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainassignment` WHERE `ComplainStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainassignment.ComplainStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainStatusID` ORDER BY c.`ComplainStatusID`) AS bad_values FROM `complainassignment` c LEFT JOIN `complainstatus` p ON c.`ComplainStatusID` = p.`ID` WHERE c.`ComplainStatusID` IS NOT NULL AND c.`ComplainStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `complainassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetails.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetails` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetails.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `complaindetails` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetails.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetails` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetails.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `complaindetails` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetails.ComplainDetailsStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetails` WHERE `ComplainDetailsStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetails.ComplainDetailsStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailsStatusID` ORDER BY c.`ComplainDetailsStatusID`) AS bad_values FROM `complaindetails` c LEFT JOIN `complaindetailsstatus` p ON c.`ComplainDetailsStatusID` = p.`ID` WHERE c.`ComplainDetailsStatusID` IS NOT NULL AND c.`ComplainDetailsStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetails.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetails` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetails.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complaindetails` c LEFT JOIN `complain` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetails.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetails` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetails.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `complaindetails` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetails.SatuanComplainQuantityID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetails` WHERE `SatuanComplainQuantityID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetails.SatuanComplainQuantityID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanComplainQuantityID` ORDER BY c.`SatuanComplainQuantityID`) AS bad_values FROM `complaindetails` c LEFT JOIN `satuan` p ON c.`SatuanComplainQuantityID` = p.`ID` WHERE c.`SatuanComplainQuantityID` IS NOT NULL AND c.`SatuanComplainQuantityID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetails.SatuanPackingID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetails` WHERE `SatuanPackingID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetails.SatuanPackingID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanPackingID` ORDER BY c.`SatuanPackingID`) AS bad_values FROM `complaindetails` c LEFT JOIN `quotationpack` p ON c.`SatuanPackingID` = p.`ID` WHERE c.`SatuanPackingID` IS NOT NULL AND c.`SatuanPackingID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetails.SatuanUnitPriceUSD' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetails` WHERE `SatuanUnitPriceUSD` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetails.SatuanUnitPriceUSD' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanUnitPriceUSD` ORDER BY c.`SatuanUnitPriceUSD`) AS bad_values FROM `complaindetails` c LEFT JOIN `satuan` p ON c.`SatuanUnitPriceUSD` = p.`ID` WHERE c.`SatuanUnitPriceUSD` IS NOT NULL AND c.`SatuanUnitPriceUSD` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsaction.ComplainDetailsID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsaction` WHERE `ComplainDetailsID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsaction.ComplainDetailsID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailsID` ORDER BY c.`ComplainDetailsID`) AS bad_values FROM `complaindetailsaction` c LEFT JOIN `complaindetails` p ON c.`ComplainDetailsID` = p.`ID` WHERE c.`ComplainDetailsID` IS NOT NULL AND c.`ComplainDetailsID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsaction.ComplainDetailsStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsaction` WHERE `ComplainDetailsStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsaction.ComplainDetailsStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailsStatusID` ORDER BY c.`ComplainDetailsStatusID`) AS bad_values FROM `complaindetailsaction` c LEFT JOIN `complaindetailsstatus` p ON c.`ComplainDetailsStatusID` = p.`ID` WHERE c.`ComplainDetailsStatusID` IS NOT NULL AND c.`ComplainDetailsStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsaction.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsaction` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsaction.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complaindetailsaction` c LEFT JOIN `complain` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsaction.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsaction` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsaction.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `complaindetailsaction` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.ComplainDetailsActionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsactionassignment` WHERE `ComplainDetailsActionID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.ComplainDetailsActionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailsActionID` ORDER BY c.`ComplainDetailsActionID`) AS bad_values FROM `complaindetailsactionassignment` c LEFT JOIN `complaindetailsaction` p ON c.`ComplainDetailsActionID` = p.`ID` WHERE c.`ComplainDetailsActionID` IS NOT NULL AND c.`ComplainDetailsActionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.ComplainDetailsID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsactionassignment` WHERE `ComplainDetailsID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.ComplainDetailsID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailsID` ORDER BY c.`ComplainDetailsID`) AS bad_values FROM `complaindetailsactionassignment` c LEFT JOIN `complaindetails` p ON c.`ComplainDetailsID` = p.`ID` WHERE c.`ComplainDetailsID` IS NOT NULL AND c.`ComplainDetailsID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.ComplainDetailsStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsactionassignment` WHERE `ComplainDetailsStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.ComplainDetailsStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailsStatusID` ORDER BY c.`ComplainDetailsStatusID`) AS bad_values FROM `complaindetailsactionassignment` c LEFT JOIN `complaindetailsstatus` p ON c.`ComplainDetailsStatusID` = p.`ID` WHERE c.`ComplainDetailsStatusID` IS NOT NULL AND c.`ComplainDetailsStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsactionassignment` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complaindetailsactionassignment` c LEFT JOIN `complain` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsactionassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsactionassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `complaindetailsactionassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsassignment.ComplainDetailsID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsassignment` WHERE `ComplainDetailsID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsassignment.ComplainDetailsID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailsID` ORDER BY c.`ComplainDetailsID`) AS bad_values FROM `complaindetailsassignment` c LEFT JOIN `complaindetails` p ON c.`ComplainDetailsID` = p.`ID` WHERE c.`ComplainDetailsID` IS NOT NULL AND c.`ComplainDetailsID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsassignment.ComplainDetailsStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsassignment` WHERE `ComplainDetailsStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsassignment.ComplainDetailsStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailsStatusID` ORDER BY c.`ComplainDetailsStatusID`) AS bad_values FROM `complaindetailsassignment` c LEFT JOIN `complaindetailsstatus` p ON c.`ComplainDetailsStatusID` = p.`ID` WHERE c.`ComplainDetailsStatusID` IS NOT NULL AND c.`ComplainDetailsStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsassignment.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsassignment` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsassignment.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complaindetailsassignment` c LEFT JOIN `complain` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaindetailsassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaindetailsassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaindetailsassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `complaindetailsassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitem.ComplainStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitem` WHERE `ComplainStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitem.ComplainStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainStatusID` ORDER BY c.`ComplainStatusID`) AS bad_values FROM `complainitem` c LEFT JOIN `complainitemstatus` p ON c.`ComplainStatusID` = p.`ID` WHERE c.`ComplainStatusID` IS NOT NULL AND c.`ComplainStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitem.ComplainTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitem` WHERE `ComplainTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitem.ComplainTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainTypeID` ORDER BY c.`ComplainTypeID`) AS bad_values FROM `complainitem` c LEFT JOIN `complainitemtype` p ON c.`ComplainTypeID` = p.`ID` WHERE c.`ComplainTypeID` IS NOT NULL AND c.`ComplainTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitem.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitem` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitem.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `complainitem` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitem.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitem` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitem.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complainitem` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemassignment.ComplainItemID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemassignment` WHERE `ComplainItemID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemassignment.ComplainItemID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemID` ORDER BY c.`ComplainItemID`) AS bad_values FROM `complainitemassignment` c LEFT JOIN `complainitem` p ON c.`ComplainItemID` = p.`ID` WHERE c.`ComplainItemID` IS NOT NULL AND c.`ComplainItemID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemassignment.ComplainItemStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemassignment` WHERE `ComplainItemStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemassignment.ComplainItemStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemStatusID` ORDER BY c.`ComplainItemStatusID`) AS bad_values FROM `complainitemassignment` c LEFT JOIN `complainitemstatus` p ON c.`ComplainItemStatusID` = p.`ID` WHERE c.`ComplainItemStatusID` IS NOT NULL AND c.`ComplainItemStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complainitemassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.ComplainDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `ComplainDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.ComplainDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainDetailStatusID` ORDER BY c.`ComplainDetailStatusID`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `complaindetailsstatus` p ON c.`ComplainDetailStatusID` = p.`ID` WHERE c.`ComplainDetailStatusID` IS NOT NULL AND c.`ComplainDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.ComplainItemID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `ComplainItemID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.ComplainItemID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemID` ORDER BY c.`ComplainItemID`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `complainitem` p ON c.`ComplainItemID` = p.`ID` WHERE c.`ComplainItemID` IS NOT NULL AND c.`ComplainItemID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.PackingMonth' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `PackingMonth` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.PackingMonth' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackingMonth` ORDER BY c.`PackingMonth`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `packing` p ON c.`PackingMonth` = p.`ID` WHERE c.`PackingMonth` IS NOT NULL AND c.`PackingMonth` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.PackingYear' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetails` WHERE `PackingYear` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetails.PackingYear' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackingYear` ORDER BY c.`PackingYear`) AS bad_values FROM `complainitemdetails` c LEFT JOIN `packing` p ON c.`PackingYear` = p.`ID` WHERE c.`PackingYear` IS NOT NULL AND c.`PackingYear` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsaction.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailsaction` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsaction.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complainitemdetailsaction` c LEFT JOIN `complainitem` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsaction.ComplainStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailsaction` WHERE `ComplainStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsaction.ComplainStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainStatusID` ORDER BY c.`ComplainStatusID`) AS bad_values FROM `complainitemdetailsaction` c LEFT JOIN `complainitemstatus` p ON c.`ComplainStatusID` = p.`ID` WHERE c.`ComplainStatusID` IS NOT NULL AND c.`ComplainStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsaction.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailsaction` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsaction.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complainitemdetailsaction` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsactionassignment.ComplainItemID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailsactionassignment` WHERE `ComplainItemID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsactionassignment.ComplainItemID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemID` ORDER BY c.`ComplainItemID`) AS bad_values FROM `complainitemdetailsactionassignment` c LEFT JOIN `complainitem` p ON c.`ComplainItemID` = p.`ID` WHERE c.`ComplainItemID` IS NOT NULL AND c.`ComplainItemID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsactionassignment.ComplainItemStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailsactionassignment` WHERE `ComplainItemStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsactionassignment.ComplainItemStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemStatusID` ORDER BY c.`ComplainItemStatusID`) AS bad_values FROM `complainitemdetailsactionassignment` c LEFT JOIN `complainitemstatus` p ON c.`ComplainItemStatusID` = p.`ID` WHERE c.`ComplainItemStatusID` IS NOT NULL AND c.`ComplainItemStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsactionassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailsactionassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailsactionassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complainitemdetailsactionassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslot.ComplainItemDetailsID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailslot` WHERE `ComplainItemDetailsID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslot.ComplainItemDetailsID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemDetailsID` ORDER BY c.`ComplainItemDetailsID`) AS bad_values FROM `complainitemdetailslot` c LEFT JOIN `complainitemdetails` p ON c.`ComplainItemDetailsID` = p.`ID` WHERE c.`ComplainItemDetailsID` IS NOT NULL AND c.`ComplainItemDetailsID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslot.ComplainItemID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailslot` WHERE `ComplainItemID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslot.ComplainItemID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemID` ORDER BY c.`ComplainItemID`) AS bad_values FROM `complainitemdetailslot` c LEFT JOIN `complainitem` p ON c.`ComplainItemID` = p.`ID` WHERE c.`ComplainItemID` IS NOT NULL AND c.`ComplainItemID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslot.PackagingID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailslot` WHERE `PackagingID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslot.PackagingID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackagingID` ORDER BY c.`PackagingID`) AS bad_values FROM `complainitemdetailslot` c LEFT JOIN `packing` p ON c.`PackagingID` = p.`ID` WHERE c.`PackagingID` IS NOT NULL AND c.`PackagingID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslotassignment.ComplainItemDetailsID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailslotassignment` WHERE `ComplainItemDetailsID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslotassignment.ComplainItemDetailsID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemDetailsID` ORDER BY c.`ComplainItemDetailsID`) AS bad_values FROM `complainitemdetailslotassignment` c LEFT JOIN `complainitemdetails` p ON c.`ComplainItemDetailsID` = p.`ID` WHERE c.`ComplainItemDetailsID` IS NOT NULL AND c.`ComplainItemDetailsID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslotassignment.ComplainItemDetailsLotID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailslotassignment` WHERE `ComplainItemDetailsLotID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslotassignment.ComplainItemDetailsLotID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemDetailsLotID` ORDER BY c.`ComplainItemDetailsLotID`) AS bad_values FROM `complainitemdetailslotassignment` c LEFT JOIN `complainitemdetailslot` p ON c.`ComplainItemDetailsLotID` = p.`ID` WHERE c.`ComplainItemDetailsLotID` IS NOT NULL AND c.`ComplainItemDetailsLotID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslotassignment.ComplainItemID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailslotassignment` WHERE `ComplainItemID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslotassignment.ComplainItemID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemID` ORDER BY c.`ComplainItemID`) AS bad_values FROM `complainitemdetailslotassignment` c LEFT JOIN `complainitem` p ON c.`ComplainItemID` = p.`ID` WHERE c.`ComplainItemID` IS NOT NULL AND c.`ComplainItemID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslotassignment.PackagingID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complainitemdetailslotassignment` WHERE `PackagingID` = 0 HAVING COUNT(*) > 0;
SELECT 'complainitemdetailslotassignment.PackagingID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackagingID` ORDER BY c.`PackagingID`) AS bad_values FROM `complainitemdetailslotassignment` c LEFT JOIN `packing` p ON c.`PackagingID` = p.`ID` WHERE c.`PackagingID` IS NOT NULL AND c.`PackagingID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ComplainItemTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `ComplainItemTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ComplainItemTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainItemTypeID` ORDER BY c.`ComplainItemTypeID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `complaintosuppliertype` p ON c.`ComplainItemTypeID` = p.`ID` WHERE c.`ComplainItemTypeID` IS NOT NULL AND c.`ComplainItemTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ComplainStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `ComplainStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ComplainStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainStatusID` ORDER BY c.`ComplainStatusID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `complaintosupplierstatus` p ON c.`ComplainStatusID` = p.`ID` WHERE c.`ComplainStatusID` IS NOT NULL AND c.`ComplainStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ComplainTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `ComplainTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ComplainTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainTypeID` ORDER BY c.`ComplainTypeID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `complaintype` p ON c.`ComplainTypeID` = p.`ID` WHERE c.`ComplainTypeID` IS NOT NULL AND c.`ComplainTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.PackingMonth' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `PackingMonth` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.PackingMonth' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackingMonth` ORDER BY c.`PackingMonth`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `packing` p ON c.`PackingMonth` = p.`ID` WHERE c.`PackingMonth` IS NOT NULL AND c.`PackingMonth` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.PackingYear' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `PackingYear` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.PackingYear' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackingYear` ORDER BY c.`PackingYear`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `packing` p ON c.`PackingYear` = p.`ID` WHERE c.`PackingYear` IS NOT NULL AND c.`PackingYear` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ProductID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `ProductID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.ProductID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductID` ORDER BY c.`ProductID`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `product` p ON c.`ProductID` = p.`ID` WHERE c.`ProductID` IS NOT NULL AND c.`ProductID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplier` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplier.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `complaintosupplier` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierassignment.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierassignment` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierassignment.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complaintosupplierassignment` c LEFT JOIN `complaintosupplier` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierassignment.ComplainStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierassignment` WHERE `ComplainStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierassignment.ComplainStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainStatusID` ORDER BY c.`ComplainStatusID`) AS bad_values FROM `complaintosupplierassignment` c LEFT JOIN `complaintosupplierstatus` p ON c.`ComplainStatusID` = p.`ID` WHERE c.`ComplainStatusID` IS NOT NULL AND c.`ComplainStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierassignment.DepartmentID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierassignment` WHERE `DepartmentID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierassignment.DepartmentID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DepartmentID` ORDER BY c.`DepartmentID`) AS bad_values FROM `complaintosupplierassignment` c LEFT JOIN `department` p ON c.`DepartmentID` = p.`ID` WHERE c.`DepartmentID` IS NOT NULL AND c.`DepartmentID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complaintosupplierassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsaction.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierdetailsaction` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsaction.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complaintosupplierdetailsaction` c LEFT JOIN `complaintosupplier` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsaction.ComplainStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierdetailsaction` WHERE `ComplainStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsaction.ComplainStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainStatusID` ORDER BY c.`ComplainStatusID`) AS bad_values FROM `complaintosupplierdetailsaction` c LEFT JOIN `complaintosupplierstatus` p ON c.`ComplainStatusID` = p.`ID` WHERE c.`ComplainStatusID` IS NOT NULL AND c.`ComplainStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsaction.DepartementID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierdetailsaction` WHERE `DepartementID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsaction.DepartementID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DepartementID` ORDER BY c.`DepartementID`) AS bad_values FROM `complaintosupplierdetailsaction` c LEFT JOIN `department` p ON c.`DepartementID` = p.`ID` WHERE c.`DepartementID` IS NOT NULL AND c.`DepartementID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsaction.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierdetailsaction` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsaction.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complaintosupplierdetailsaction` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsactionassignment.ComplainID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierdetailsactionassignment` WHERE `ComplainID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsactionassignment.ComplainID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainID` ORDER BY c.`ComplainID`) AS bad_values FROM `complaintosupplierdetailsactionassignment` c LEFT JOIN `complaintosupplier` p ON c.`ComplainID` = p.`ID` WHERE c.`ComplainID` IS NOT NULL AND c.`ComplainID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsactionassignment.ComplainStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierdetailsactionassignment` WHERE `ComplainStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsactionassignment.ComplainStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ComplainStatusID` ORDER BY c.`ComplainStatusID`) AS bad_values FROM `complaintosupplierdetailsactionassignment` c LEFT JOIN `complaintosupplierstatus` p ON c.`ComplainStatusID` = p.`ID` WHERE c.`ComplainStatusID` IS NOT NULL AND c.`ComplainStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsactionassignment.DepartmentID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierdetailsactionassignment` WHERE `DepartmentID` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsactionassignment.DepartmentID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DepartmentID` ORDER BY c.`DepartmentID`) AS bad_values FROM `complaintosupplierdetailsactionassignment` c LEFT JOIN `department` p ON c.`DepartmentID` = p.`ID` WHERE c.`DepartmentID` IS NOT NULL AND c.`DepartmentID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsactionassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `complaintosupplierdetailsactionassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'complaintosupplierdetailsactionassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `complaintosupplierdetailsactionassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'division.GroupDivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `division` WHERE `GroupDivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'division.GroupDivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`GroupDivisionID` ORDER BY c.`GroupDivisionID`) AS bad_values FROM `division` c LEFT JOIN `groupdivision` p ON c.`GroupDivisionID` = p.`ID` WHERE c.`GroupDivisionID` IS NOT NULL AND c.`GroupDivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'documentgroupdivision.DocID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `documentgroupdivision` WHERE `DocID` = 0 HAVING COUNT(*) > 0;
SELECT 'documentgroupdivision.DocID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DocID` ORDER BY c.`DocID`) AS bad_values FROM `documentgroupdivision` c LEFT JOIN `documentupload` p ON c.`DocID` = p.`ID` WHERE c.`DocID` IS NOT NULL AND c.`DocID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'documentgroupdivision.GroupDivID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `documentgroupdivision` WHERE `GroupDivID` = 0 HAVING COUNT(*) > 0;
SELECT 'documentgroupdivision.GroupDivID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`GroupDivID` ORDER BY c.`GroupDivID`) AS bad_values FROM `documentgroupdivision` c LEFT JOIN `groupdivision` p ON c.`GroupDivID` = p.`ID` WHERE c.`GroupDivID` IS NOT NULL AND c.`GroupDivID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'documentupload.DocumentCategoryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `documentupload` WHERE `DocumentCategoryID` = 0 HAVING COUNT(*) > 0;
SELECT 'documentupload.DocumentCategoryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DocumentCategoryID` ORDER BY c.`DocumentCategoryID`) AS bad_values FROM `documentupload` c LEFT JOIN `documentcategory` p ON c.`DocumentCategoryID` = p.`ID` WHERE c.`DocumentCategoryID` IS NOT NULL AND c.`DocumentCategoryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'documentupload.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `documentupload` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'documentupload.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `documentupload` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'documentuploadinternal.DocumentCategoryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `documentuploadinternal` WHERE `DocumentCategoryID` = 0 HAVING COUNT(*) > 0;
SELECT 'documentuploadinternal.DocumentCategoryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DocumentCategoryID` ORDER BY c.`DocumentCategoryID`) AS bad_values FROM `documentuploadinternal` c LEFT JOIN `documentcategory` p ON c.`DocumentCategoryID` = p.`ID` WHERE c.`DocumentCategoryID` IS NOT NULL AND c.`DocumentCategoryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izin.IzinStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izin` WHERE `IzinStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'izin.IzinStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IzinStatusID` ORDER BY c.`IzinStatusID`) AS bad_values FROM `izin` c LEFT JOIN `izinstatus` p ON c.`IzinStatusID` = p.`ID` WHERE c.`IzinStatusID` IS NOT NULL AND c.`IzinStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izin.IzinTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izin` WHERE `IzinTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'izin.IzinTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IzinTypeID` ORDER BY c.`IzinTypeID`) AS bad_values FROM `izin` c LEFT JOIN `izintype` p ON c.`IzinTypeID` = p.`ID` WHERE c.`IzinTypeID` IS NOT NULL AND c.`IzinTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izin.IzinTypeStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izin` WHERE `IzinTypeStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'izin.IzinTypeStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IzinTypeStatusID` ORDER BY c.`IzinTypeStatusID`) AS bad_values FROM `izin` c LEFT JOIN `izintypestatus` p ON c.`IzinTypeStatusID` = p.`ID` WHERE c.`IzinTypeStatusID` IS NOT NULL AND c.`IzinTypeStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izin.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izin` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'izin.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `izin` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izin.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izin` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'izin.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `izin` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izinassignment.IzinID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izinassignment` WHERE `IzinID` = 0 HAVING COUNT(*) > 0;
SELECT 'izinassignment.IzinID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IzinID` ORDER BY c.`IzinID`) AS bad_values FROM `izinassignment` c LEFT JOIN `izin` p ON c.`IzinID` = p.`ID` WHERE c.`IzinID` IS NOT NULL AND c.`IzinID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izinassignment.IzinStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izinassignment` WHERE `IzinStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'izinassignment.IzinStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IzinStatusID` ORDER BY c.`IzinStatusID`) AS bad_values FROM `izinassignment` c LEFT JOIN `izinstatus` p ON c.`IzinStatusID` = p.`ID` WHERE c.`IzinStatusID` IS NOT NULL AND c.`IzinStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izinassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izinassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'izinassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `izinassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'izintypestatus.IzinTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `izintypestatus` WHERE `IzinTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'izintypestatus.IzinTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IzinTypeID` ORDER BY c.`IzinTypeID`) AS bad_values FROM `izintypestatus` c LEFT JOIN `izintype` p ON c.`IzinTypeID` = p.`ID` WHERE c.`IzinTypeID` IS NOT NULL AND c.`IzinTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `labworkrequest` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `labworkrequest` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `labworkrequest` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `labworkrequest` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.LabWorkRequestFeedbackStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `LabWorkRequestFeedbackStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.LabWorkRequestFeedbackStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestFeedbackStatusID` ORDER BY c.`LabWorkRequestFeedbackStatusID`) AS bad_values FROM `labworkrequest` c LEFT JOIN `labworkrequestfeedbackstatus` p ON c.`LabWorkRequestFeedbackStatusID` = p.`ID` WHERE c.`LabWorkRequestFeedbackStatusID` IS NOT NULL AND c.`LabWorkRequestFeedbackStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.LabWorkRequestStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `LabWorkRequestStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.LabWorkRequestStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestStatusID` ORDER BY c.`LabWorkRequestStatusID`) AS bad_values FROM `labworkrequest` c LEFT JOIN `labworkrequeststatus` p ON c.`LabWorkRequestStatusID` = p.`ID` WHERE c.`LabWorkRequestStatusID` IS NOT NULL AND c.`LabWorkRequestStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `labworkrequest` c LEFT JOIN `companyproject` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `labworkrequest` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.UserIDProjectInitiator' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `UserIDProjectInitiator` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.UserIDProjectInitiator' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDProjectInitiator` ORDER BY c.`UserIDProjectInitiator`) AS bad_values FROM `labworkrequest` c LEFT JOIN `users` p ON c.`UserIDProjectInitiator` = p.`ID` WHERE c.`UserIDProjectInitiator` IS NOT NULL AND c.`UserIDProjectInitiator` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequest.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequest` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequest.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `labworkrequest` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestassignment.LabWorkRequestID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestassignment` WHERE `LabWorkRequestID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestassignment.LabWorkRequestID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestID` ORDER BY c.`LabWorkRequestID`) AS bad_values FROM `labworkrequestassignment` c LEFT JOIN `labworkrequest` p ON c.`LabWorkRequestID` = p.`ID` WHERE c.`LabWorkRequestID` IS NOT NULL AND c.`LabWorkRequestID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestassignment.LabWorkRequestStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestassignment` WHERE `LabWorkRequestStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestassignment.LabWorkRequestStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestStatusID` ORDER BY c.`LabWorkRequestStatusID`) AS bad_values FROM `labworkrequestassignment` c LEFT JOIN `labworkrequeststatus` p ON c.`LabWorkRequestStatusID` = p.`ID` WHERE c.`LabWorkRequestStatusID` IS NOT NULL AND c.`LabWorkRequestStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `labworkrequestassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.LabWorkRequestDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `LabWorkRequestDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.LabWorkRequestDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestDetailStatusID` ORDER BY c.`LabWorkRequestDetailStatusID`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `labworkrequestdetailstatus` p ON c.`LabWorkRequestDetailStatusID` = p.`ID` WHERE c.`LabWorkRequestDetailStatusID` IS NOT NULL AND c.`LabWorkRequestDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.LabWorkRequestID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `LabWorkRequestID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.LabWorkRequestID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestID` ORDER BY c.`LabWorkRequestID`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `labworkrequest` p ON c.`LabWorkRequestID` = p.`ID` WHERE c.`LabWorkRequestID` IS NOT NULL AND c.`LabWorkRequestID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `companyprojectdetailcc` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.ProjectIDComp' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `ProjectIDComp` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.ProjectIDComp' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectIDComp` ORDER BY c.`ProjectIDComp`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `companyprojectdetailcomp` p ON c.`ProjectIDComp` = p.`ID` WHERE c.`ProjectIDComp` IS NOT NULL AND c.`ProjectIDComp` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.SatuanIDUnitPrice' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `SatuanIDUnitPrice` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.SatuanIDUnitPrice' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanIDUnitPrice` ORDER BY c.`SatuanIDUnitPrice`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `satuan` p ON c.`SatuanIDUnitPrice` = p.`ID` WHERE c.`SatuanIDUnitPrice` IS NOT NULL AND c.`SatuanIDUnitPrice` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.SatuanIDVolume' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `SatuanIDVolume` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.SatuanIDVolume' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanIDVolume` ORDER BY c.`SatuanIDVolume`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `satuan` p ON c.`SatuanIDVolume` = p.`ID` WHERE c.`SatuanIDVolume` IS NOT NULL AND c.`SatuanIDVolume` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.TypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetails` WHERE `TypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetails.TypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`TypeID` ORDER BY c.`TypeID`) AS bad_values FROM `labworkrequestdetails` c LEFT JOIN `type` p ON c.`TypeID` = p.`ID` WHERE c.`TypeID` IS NOT NULL AND c.`TypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetailsassignment.LabWorkRequestDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetailsassignment` WHERE `LabWorkRequestDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetailsassignment.LabWorkRequestDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestDetailID` ORDER BY c.`LabWorkRequestDetailID`) AS bad_values FROM `labworkrequestdetailsassignment` c LEFT JOIN `labworkrequestdetails` p ON c.`LabWorkRequestDetailID` = p.`ID` WHERE c.`LabWorkRequestDetailID` IS NOT NULL AND c.`LabWorkRequestDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetailsassignment.LabWorkRequestDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetailsassignment` WHERE `LabWorkRequestDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetailsassignment.LabWorkRequestDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestDetailStatusID` ORDER BY c.`LabWorkRequestDetailStatusID`) AS bad_values FROM `labworkrequestdetailsassignment` c LEFT JOIN `labworkrequestdetailstatus` p ON c.`LabWorkRequestDetailStatusID` = p.`ID` WHERE c.`LabWorkRequestDetailStatusID` IS NOT NULL AND c.`LabWorkRequestDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetailsassignment.LabWorkRequestID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetailsassignment` WHERE `LabWorkRequestID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetailsassignment.LabWorkRequestID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestID` ORDER BY c.`LabWorkRequestID`) AS bad_values FROM `labworkrequestdetailsassignment` c LEFT JOIN `labworkrequest` p ON c.`LabWorkRequestID` = p.`ID` WHERE c.`LabWorkRequestID` IS NOT NULL AND c.`LabWorkRequestID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetailsassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestdetailsassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestdetailsassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `labworkrequestdetailsassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'labworkrequestlink.LabWorkRequestID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `labworkrequestlink` WHERE `LabWorkRequestID` = 0 HAVING COUNT(*) > 0;
SELECT 'labworkrequestlink.LabWorkRequestID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LabWorkRequestID` ORDER BY c.`LabWorkRequestID`) AS bad_values FROM `labworkrequestlink` c LEFT JOIN `labworkrequest` p ON c.`LabWorkRequestID` = p.`ID` WHERE c.`LabWorkRequestID` IS NOT NULL AND c.`LabWorkRequestID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'lembur.LemburStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `lembur` WHERE `LemburStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'lembur.LemburStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LemburStatusID` ORDER BY c.`LemburStatusID`) AS bad_values FROM `lembur` c LEFT JOIN `lemburstatus` p ON c.`LemburStatusID` = p.`ID` WHERE c.`LemburStatusID` IS NOT NULL AND c.`LemburStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'lembur.LemburTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `lembur` WHERE `LemburTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'lembur.LemburTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LemburTypeID` ORDER BY c.`LemburTypeID`) AS bad_values FROM `lembur` c LEFT JOIN `lemburtype` p ON c.`LemburTypeID` = p.`ID` WHERE c.`LemburTypeID` IS NOT NULL AND c.`LemburTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'lembur.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `lembur` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'lembur.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `lembur` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'lembur.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `lembur` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'lembur.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `lembur` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'lemburassignment.LemburID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `lemburassignment` WHERE `LemburID` = 0 HAVING COUNT(*) > 0;
SELECT 'lemburassignment.LemburID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LemburID` ORDER BY c.`LemburID`) AS bad_values FROM `lemburassignment` c LEFT JOIN `lembur` p ON c.`LemburID` = p.`ID` WHERE c.`LemburID` IS NOT NULL AND c.`LemburID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'lemburassignment.LemburStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `lemburassignment` WHERE `LemburStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'lemburassignment.LemburStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LemburStatusID` ORDER BY c.`LemburStatusID`) AS bad_values FROM `lemburassignment` c LEFT JOIN `lemburstatus` p ON c.`LemburStatusID` = p.`ID` WHERE c.`LemburStatusID` IS NOT NULL AND c.`LemburStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'lemburassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `lemburassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'lemburassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `lemburassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'menu.ParentID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `menu` WHERE `ParentID` = 0 HAVING COUNT(*) > 0;
SELECT 'menu.ParentID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ParentID` ORDER BY c.`ParentID`) AS bad_values FROM `menu` c LEFT JOIN `menu` p ON c.`ParentID` = p.`ID` WHERE c.`ParentID` IS NOT NULL AND c.`ParentID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'news.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `news` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'news.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `news` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleave.OnLeaveLimitID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleave` WHERE `OnLeaveLimitID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleave.OnLeaveLimitID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`OnLeaveLimitID` ORDER BY c.`OnLeaveLimitID`) AS bad_values FROM `onleave` c LEFT JOIN `onleavelimit` p ON c.`OnLeaveLimitID` = p.`ID` WHERE c.`OnLeaveLimitID` IS NOT NULL AND c.`OnLeaveLimitID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleave.OnLeaveStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleave` WHERE `OnLeaveStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleave.OnLeaveStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`OnLeaveStatusID` ORDER BY c.`OnLeaveStatusID`) AS bad_values FROM `onleave` c LEFT JOIN `onleavestatus` p ON c.`OnLeaveStatusID` = p.`ID` WHERE c.`OnLeaveStatusID` IS NOT NULL AND c.`OnLeaveStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleave.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleave` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'onleave.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `onleave` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleave.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleave` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'onleave.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `onleave` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleave.UserPengganti1' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleave` WHERE `UserPengganti1` = 0 HAVING COUNT(*) > 0;
SELECT 'onleave.UserPengganti1' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserPengganti1` ORDER BY c.`UserPengganti1`) AS bad_values FROM `onleave` c LEFT JOIN `users` p ON c.`UserPengganti1` = p.`ID` WHERE c.`UserPengganti1` IS NOT NULL AND c.`UserPengganti1` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleave.UserPengganti2' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleave` WHERE `UserPengganti2` = 0 HAVING COUNT(*) > 0;
SELECT 'onleave.UserPengganti2' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserPengganti2` ORDER BY c.`UserPengganti2`) AS bad_values FROM `onleave` c LEFT JOIN `users` p ON c.`UserPengganti2` = p.`ID` WHERE c.`UserPengganti2` IS NOT NULL AND c.`UserPengganti2` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleaveadditional.OnLeaveLimitID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleaveadditional` WHERE `OnLeaveLimitID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleaveadditional.OnLeaveLimitID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`OnLeaveLimitID` ORDER BY c.`OnLeaveLimitID`) AS bad_values FROM `onleaveadditional` c LEFT JOIN `onleavelimit` p ON c.`OnLeaveLimitID` = p.`ID` WHERE c.`OnLeaveLimitID` IS NOT NULL AND c.`OnLeaveLimitID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleaveadditional.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleaveadditional` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleaveadditional.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `onleaveadditional` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleaveadditional.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleaveadditional` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'onleaveadditional.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `onleaveadditional` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleaveadditionalassignment.OnLeaveAdditionalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleaveadditionalassignment` WHERE `OnLeaveAdditionalID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleaveadditionalassignment.OnLeaveAdditionalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`OnLeaveAdditionalID` ORDER BY c.`OnLeaveAdditionalID`) AS bad_values FROM `onleaveadditionalassignment` c LEFT JOIN `onleaveadditional` p ON c.`OnLeaveAdditionalID` = p.`ID` WHERE c.`OnLeaveAdditionalID` IS NOT NULL AND c.`OnLeaveAdditionalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleaveadditionalassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleaveadditionalassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleaveadditionalassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `onleaveadditionalassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleaveassignment.OnLeaveID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleaveassignment` WHERE `OnLeaveID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleaveassignment.OnLeaveID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`OnLeaveID` ORDER BY c.`OnLeaveID`) AS bad_values FROM `onleaveassignment` c LEFT JOIN `onleave` p ON c.`OnLeaveID` = p.`ID` WHERE c.`OnLeaveID` IS NOT NULL AND c.`OnLeaveID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleaveassignment.OnLeaveStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleaveassignment` WHERE `OnLeaveStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleaveassignment.OnLeaveStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`OnLeaveStatusID` ORDER BY c.`OnLeaveStatusID`) AS bad_values FROM `onleaveassignment` c LEFT JOIN `onleavestatus` p ON c.`OnLeaveStatusID` = p.`ID` WHERE c.`OnLeaveStatusID` IS NOT NULL AND c.`OnLeaveStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'onleaveassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `onleaveassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'onleaveassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `onleaveassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'packing.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `packing` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'packing.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `packing` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'potentialsales.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `potentialsales` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'potentialsales.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `potentialsales` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'potentialsales.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `potentialsales` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'potentialsales.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `potentialsales` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'potentialsales.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `potentialsales` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'potentialsales.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `potentialsales` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `potentialsaleshistory` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `potentialsaleshistory` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `potentialsaleshistory` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `potentialsaleshistory` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.PotentialSalesID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `potentialsaleshistory` WHERE `PotentialSalesID` = 0 HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.PotentialSalesID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PotentialSalesID` ORDER BY c.`PotentialSalesID`) AS bad_values FROM `potentialsaleshistory` c LEFT JOIN `potentialsales` p ON c.`PotentialSalesID` = p.`ID` WHERE c.`PotentialSalesID` IS NOT NULL AND c.`PotentialSalesID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `potentialsaleshistory` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `potentialsaleshistory` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `potentialsaleshistory` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'potentialsaleshistory.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `potentialsaleshistory` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalcp.AddressType' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalcp` WHERE `AddressType` = 0 HAVING COUNT(*) > 0;
SELECT 'principalcp.AddressType' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`AddressType` ORDER BY c.`AddressType`) AS bad_values FROM `principalcp` c LEFT JOIN `addresstype` p ON c.`AddressType` = p.`ID` WHERE c.`AddressType` IS NOT NULL AND c.`AddressType` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalcp.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalcp` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'principalcp.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `principalcp` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalcpassignment.AddressType' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalcpassignment` WHERE `AddressType` = 0 HAVING COUNT(*) > 0;
SELECT 'principalcpassignment.AddressType' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`AddressType` ORDER BY c.`AddressType`) AS bad_values FROM `principalcpassignment` c LEFT JOIN `addresstype` p ON c.`AddressType` = p.`ID` WHERE c.`AddressType` IS NOT NULL AND c.`AddressType` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalcpassignment.PrincipalCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalcpassignment` WHERE `PrincipalCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'principalcpassignment.PrincipalCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalCPID` ORDER BY c.`PrincipalCPID`) AS bad_values FROM `principalcpassignment` c LEFT JOIN `principalcp` p ON c.`PrincipalCPID` = p.`ID` WHERE c.`PrincipalCPID` IS NOT NULL AND c.`PrincipalCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalcpassignment.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalcpassignment` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'principalcpassignment.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `principalcpassignment` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalcpassignment.UsersID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalcpassignment` WHERE `UsersID` = 0 HAVING COUNT(*) > 0;
SELECT 'principalcpassignment.UsersID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UsersID` ORDER BY c.`UsersID`) AS bad_values FROM `principalcpassignment` c LEFT JOIN `users` p ON c.`UsersID` = p.`ID` WHERE c.`UsersID` IS NOT NULL AND c.`UsersID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalfaq.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalfaq` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'principalfaq.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `principalfaq` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalfaqhistory.PrincipalFAQID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalfaqhistory` WHERE `PrincipalFAQID` = 0 HAVING COUNT(*) > 0;
SELECT 'principalfaqhistory.PrincipalFAQID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalFAQID` ORDER BY c.`PrincipalFAQID`) AS bad_values FROM `principalfaqhistory` c LEFT JOIN `principalfaq` p ON c.`PrincipalFAQID` = p.`ID` WHERE c.`PrincipalFAQID` IS NOT NULL AND c.`PrincipalFAQID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'principalfaqhistory.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `principalfaqhistory` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'principalfaqhistory.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `principalfaqhistory` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'printeditemfulfillment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `printeditemfulfillment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'printeditemfulfillment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `printeditemfulfillment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'product.ClassID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `product` WHERE `ClassID` = 0 HAVING COUNT(*) > 0;
SELECT 'product.ClassID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ClassID` ORDER BY c.`ClassID`) AS bad_values FROM `product` c LEFT JOIN `class` p ON c.`ClassID` = p.`ID` WHERE c.`ClassID` IS NOT NULL AND c.`ClassID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'product.PackingID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `product` WHERE `PackingID` = 0 HAVING COUNT(*) > 0;
SELECT 'product.PackingID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackingID` ORDER BY c.`PackingID`) AS bad_values FROM `product` c LEFT JOIN `packing` p ON c.`PackingID` = p.`ID` WHERE c.`PackingID` IS NOT NULL AND c.`PackingID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'product.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `product` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'product.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `product` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'productapplication.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `productapplication` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'productapplication.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `productapplication` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'productapplication.ProductID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `productapplication` WHERE `ProductID` = 0 HAVING COUNT(*) > 0;
SELECT 'productapplication.ProductID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductID` ORDER BY c.`ProductID`) AS bad_values FROM `productapplication` c LEFT JOIN `barang` p ON c.`ProductID` = p.`ID` WHERE c.`ProductID` IS NOT NULL AND c.`ProductID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'productapplication.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `productapplication` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'productapplication.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `productapplication` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'productcategory.CategoryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `productcategory` WHERE `CategoryID` = 0 HAVING COUNT(*) > 0;
SELECT 'productcategory.CategoryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CategoryID` ORDER BY c.`CategoryID`) AS bad_values FROM `productcategory` c LEFT JOIN `category` p ON c.`CategoryID` = p.`ID` WHERE c.`CategoryID` IS NOT NULL AND c.`CategoryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'productcategory.ProductID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `productcategory` WHERE `ProductID` = 0 HAVING COUNT(*) > 0;
SELECT 'productcategory.ProductID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductID` ORDER BY c.`ProductID`) AS bad_values FROM `productcategory` c LEFT JOIN `barang` p ON c.`ProductID` = p.`ID` WHERE c.`ProductID` IS NOT NULL AND c.`ProductID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'productcategory.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `productcategory` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'productcategory.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `productcategory` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.CCStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceiling` WHERE `CCStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.CCStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCStatusID` ORDER BY c.`CCStatusID`) AS bad_values FROM `proposedcreditceiling` c LEFT JOIN `creditceilingstatus` p ON c.`CCStatusID` = p.`ID` WHERE c.`CCStatusID` IS NOT NULL AND c.`CCStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceiling` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `proposedcreditceiling` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.JustificationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceiling` WHERE `JustificationID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.JustificationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`JustificationID` ORDER BY c.`JustificationID`) AS bad_values FROM `proposedcreditceiling` c LEFT JOIN `justification` p ON c.`JustificationID` = p.`ID` WHERE c.`JustificationID` IS NOT NULL AND c.`JustificationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.QuotationPaymentTermApprovedID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceiling` WHERE `QuotationPaymentTermApprovedID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.QuotationPaymentTermApprovedID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationPaymentTermApprovedID` ORDER BY c.`QuotationPaymentTermApprovedID`) AS bad_values FROM `proposedcreditceiling` c LEFT JOIN `quotationpaymentterm` p ON c.`QuotationPaymentTermApprovedID` = p.`ID` WHERE c.`QuotationPaymentTermApprovedID` IS NOT NULL AND c.`QuotationPaymentTermApprovedID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.QuotationPaymentTermID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceiling` WHERE `QuotationPaymentTermID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.QuotationPaymentTermID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationPaymentTermID` ORDER BY c.`QuotationPaymentTermID`) AS bad_values FROM `proposedcreditceiling` c LEFT JOIN `quotationpaymentterm` p ON c.`QuotationPaymentTermID` = p.`ID` WHERE c.`QuotationPaymentTermID` IS NOT NULL AND c.`QuotationPaymentTermID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceiling` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceiling.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `proposedcreditceiling` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.CCStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceilinghistory` WHERE `CCStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.CCStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCStatusID` ORDER BY c.`CCStatusID`) AS bad_values FROM `proposedcreditceilinghistory` c LEFT JOIN `creditceilingstatus` p ON c.`CCStatusID` = p.`ID` WHERE c.`CCStatusID` IS NOT NULL AND c.`CCStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceilinghistory` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `proposedcreditceilinghistory` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.JustificationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceilinghistory` WHERE `JustificationID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.JustificationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`JustificationID` ORDER BY c.`JustificationID`) AS bad_values FROM `proposedcreditceilinghistory` c LEFT JOIN `justification` p ON c.`JustificationID` = p.`ID` WHERE c.`JustificationID` IS NOT NULL AND c.`JustificationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.ProposedCCID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceilinghistory` WHERE `ProposedCCID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.ProposedCCID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProposedCCID` ORDER BY c.`ProposedCCID`) AS bad_values FROM `proposedcreditceilinghistory` c LEFT JOIN `proposedcreditceiling` p ON c.`ProposedCCID` = p.`ID` WHERE c.`ProposedCCID` IS NOT NULL AND c.`ProposedCCID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.QuotationPaymentTermApprovedID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceilinghistory` WHERE `QuotationPaymentTermApprovedID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.QuotationPaymentTermApprovedID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationPaymentTermApprovedID` ORDER BY c.`QuotationPaymentTermApprovedID`) AS bad_values FROM `proposedcreditceilinghistory` c LEFT JOIN `quotationpaymentterm` p ON c.`QuotationPaymentTermApprovedID` = p.`ID` WHERE c.`QuotationPaymentTermApprovedID` IS NOT NULL AND c.`QuotationPaymentTermApprovedID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.QuotationPaymentTermID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceilinghistory` WHERE `QuotationPaymentTermID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.QuotationPaymentTermID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationPaymentTermID` ORDER BY c.`QuotationPaymentTermID`) AS bad_values FROM `proposedcreditceilinghistory` c LEFT JOIN `quotationpaymentterm` p ON c.`QuotationPaymentTermID` = p.`ID` WHERE c.`QuotationPaymentTermID` IS NOT NULL AND c.`QuotationPaymentTermID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `proposedcreditceilinghistory` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'proposedcreditceilinghistory.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `proposedcreditceilinghistory` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorder.PurchaseOrderStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorder` WHERE `PurchaseOrderStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorder.PurchaseOrderStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PurchaseOrderStatusID` ORDER BY c.`PurchaseOrderStatusID`) AS bad_values FROM `purchaseorder` c LEFT JOIN `purchaseorderstatus` p ON c.`PurchaseOrderStatusID` = p.`ID` WHERE c.`PurchaseOrderStatusID` IS NOT NULL AND c.`PurchaseOrderStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorder.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorder` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorder.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `purchaseorder` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderassignment.PurchaseOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderassignment` WHERE `PurchaseOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderassignment.PurchaseOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PurchaseOrderID` ORDER BY c.`PurchaseOrderID`) AS bad_values FROM `purchaseorderassignment` c LEFT JOIN `purchaseorder` p ON c.`PurchaseOrderID` = p.`ID` WHERE c.`PurchaseOrderID` IS NOT NULL AND c.`PurchaseOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderassignment.PurchaseOrderStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderassignment` WHERE `PurchaseOrderStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderassignment.PurchaseOrderStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PurchaseOrderStatusID` ORDER BY c.`PurchaseOrderStatusID`) AS bad_values FROM `purchaseorderassignment` c LEFT JOIN `purchaseorderstatus` p ON c.`PurchaseOrderStatusID` = p.`ID` WHERE c.`PurchaseOrderStatusID` IS NOT NULL AND c.`PurchaseOrderStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `purchaseorderassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.PackingID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetails` WHERE `PackingID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.PackingID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackingID` ORDER BY c.`PackingID`) AS bad_values FROM `purchaseorderdetails` c LEFT JOIN `packing` p ON c.`PackingID` = p.`ID` WHERE c.`PackingID` IS NOT NULL AND c.`PackingID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.PurchaseOrderDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetails` WHERE `PurchaseOrderDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.PurchaseOrderDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PurchaseOrderDetailStatusID` ORDER BY c.`PurchaseOrderDetailStatusID`) AS bad_values FROM `purchaseorderdetails` c LEFT JOIN `purchaseorderstatus` p ON c.`PurchaseOrderDetailStatusID` = p.`ID` WHERE c.`PurchaseOrderDetailStatusID` IS NOT NULL AND c.`PurchaseOrderDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.PurchaseOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetails` WHERE `PurchaseOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.PurchaseOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PurchaseOrderID` ORDER BY c.`PurchaseOrderID`) AS bad_values FROM `purchaseorderdetails` c LEFT JOIN `purchaseorder` p ON c.`PurchaseOrderID` = p.`ID` WHERE c.`PurchaseOrderID` IS NOT NULL AND c.`PurchaseOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetails` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `purchaseorderdetails` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.SatuanOrderQtyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetails` WHERE `SatuanOrderQtyID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetails.SatuanOrderQtyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanOrderQtyID` ORDER BY c.`SatuanOrderQtyID`) AS bad_values FROM `purchaseorderdetails` c LEFT JOIN `satuan` p ON c.`SatuanOrderQtyID` = p.`ID` WHERE c.`SatuanOrderQtyID` IS NOT NULL AND c.`SatuanOrderQtyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetailsassignment.PurchaseOrderDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetailsassignment` WHERE `PurchaseOrderDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetailsassignment.PurchaseOrderDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PurchaseOrderDetailID` ORDER BY c.`PurchaseOrderDetailID`) AS bad_values FROM `purchaseorderdetailsassignment` c LEFT JOIN `purchaseorderdetails` p ON c.`PurchaseOrderDetailID` = p.`ID` WHERE c.`PurchaseOrderDetailID` IS NOT NULL AND c.`PurchaseOrderDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetailsassignment.PurchaseOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetailsassignment` WHERE `PurchaseOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetailsassignment.PurchaseOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PurchaseOrderID` ORDER BY c.`PurchaseOrderID`) AS bad_values FROM `purchaseorderdetailsassignment` c LEFT JOIN `purchaseorder` p ON c.`PurchaseOrderID` = p.`ID` WHERE c.`PurchaseOrderID` IS NOT NULL AND c.`PurchaseOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetailsassignment.PurchaseOrderStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetailsassignment` WHERE `PurchaseOrderStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetailsassignment.PurchaseOrderStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PurchaseOrderStatusID` ORDER BY c.`PurchaseOrderStatusID`) AS bad_values FROM `purchaseorderdetailsassignment` c LEFT JOIN `purchaseorderstatus` p ON c.`PurchaseOrderStatusID` = p.`ID` WHERE c.`PurchaseOrderStatusID` IS NOT NULL AND c.`PurchaseOrderStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetailsassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderdetailsassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderdetailsassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `purchaseorderdetailsassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'purchaseorderhargajual.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `purchaseorderhargajual` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'purchaseorderhargajual.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `purchaseorderhargajual` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `quotation` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `quotation` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.DeliveryAddressID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `DeliveryAddressID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.DeliveryAddressID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DeliveryAddressID` ORDER BY c.`DeliveryAddressID`) AS bad_values FROM `quotation` c LEFT JOIN `companycp` p ON c.`DeliveryAddressID` = p.`ID` WHERE c.`DeliveryAddressID` IS NOT NULL AND c.`DeliveryAddressID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `quotation` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.InvoiceAddressID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `InvoiceAddressID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.InvoiceAddressID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`InvoiceAddressID` ORDER BY c.`InvoiceAddressID`) AS bad_values FROM `quotation` c LEFT JOIN `companycp` p ON c.`InvoiceAddressID` = p.`ID` WHERE c.`InvoiceAddressID` IS NOT NULL AND c.`InvoiceAddressID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationDeliveryTimeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationDeliveryTimeID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationDeliveryTimeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationDeliveryTimeID` ORDER BY c.`QuotationDeliveryTimeID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationdeliverytime` p ON c.`QuotationDeliveryTimeID` = p.`ID` WHERE c.`QuotationDeliveryTimeID` IS NOT NULL AND c.`QuotationDeliveryTimeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationFeedbackStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationFeedbackStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationFeedbackStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationFeedbackStatusID` ORDER BY c.`QuotationFeedbackStatusID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationfeedbackstatus` p ON c.`QuotationFeedbackStatusID` = p.`ID` WHERE c.`QuotationFeedbackStatusID` IS NOT NULL AND c.`QuotationFeedbackStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationPaymentTermID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationPaymentTermID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationPaymentTermID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationPaymentTermID` ORDER BY c.`QuotationPaymentTermID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationpaymentterm` p ON c.`QuotationPaymentTermID` = p.`ID` WHERE c.`QuotationPaymentTermID` IS NOT NULL AND c.`QuotationPaymentTermID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationPriceDescID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationPriceDescID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationPriceDescID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationPriceDescID` ORDER BY c.`QuotationPriceDescID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationpricedesc` p ON c.`QuotationPriceDescID` = p.`ID` WHERE c.`QuotationPriceDescID` IS NOT NULL AND c.`QuotationPriceDescID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationSalesTermID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationSalesTermID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationSalesTermID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationSalesTermID` ORDER BY c.`QuotationSalesTermID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationsalesterm` p ON c.`QuotationSalesTermID` = p.`ID` WHERE c.`QuotationSalesTermID` IS NOT NULL AND c.`QuotationSalesTermID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationStatusID` ORDER BY c.`QuotationStatusID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationstatus` p ON c.`QuotationStatusID` = p.`ID` WHERE c.`QuotationStatusID` IS NOT NULL AND c.`QuotationStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationStockAvailibilityID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationStockAvailibilityID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationStockAvailibilityID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationStockAvailibilityID` ORDER BY c.`QuotationStockAvailibilityID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationstockavailability` p ON c.`QuotationStockAvailibilityID` = p.`ID` WHERE c.`QuotationStockAvailibilityID` IS NOT NULL AND c.`QuotationStockAvailibilityID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationSubjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationSubjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationSubjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationSubjectID` ORDER BY c.`QuotationSubjectID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationsubject` p ON c.`QuotationSubjectID` = p.`ID` WHERE c.`QuotationSubjectID` IS NOT NULL AND c.`QuotationSubjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationTitleID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationTitleID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationTitleID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationTitleID` ORDER BY c.`QuotationTitleID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationtitle` p ON c.`QuotationTitleID` = p.`ID` WHERE c.`QuotationTitleID` IS NOT NULL AND c.`QuotationTitleID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationTypeID` ORDER BY c.`QuotationTypeID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationtype` p ON c.`QuotationTypeID` = p.`ID` WHERE c.`QuotationTypeID` IS NOT NULL AND c.`QuotationTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationValidityID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `QuotationValidityID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.QuotationValidityID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationValidityID` ORDER BY c.`QuotationValidityID`) AS bad_values FROM `quotation` c LEFT JOIN `quotationvalidity` p ON c.`QuotationValidityID` = p.`ID` WHERE c.`QuotationValidityID` IS NOT NULL AND c.`QuotationValidityID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.ReferenceQuotationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `ReferenceQuotationID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.ReferenceQuotationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ReferenceQuotationID` ORDER BY c.`ReferenceQuotationID`) AS bad_values FROM `quotation` c LEFT JOIN `quotation` p ON c.`ReferenceQuotationID` = p.`ID` WHERE c.`ReferenceQuotationID` IS NOT NULL AND c.`ReferenceQuotationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `quotation` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotation.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotation` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'quotation.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `quotation` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationassignment.QuotationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationassignment` WHERE `QuotationID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationassignment.QuotationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationID` ORDER BY c.`QuotationID`) AS bad_values FROM `quotationassignment` c LEFT JOIN `quotation` p ON c.`QuotationID` = p.`ID` WHERE c.`QuotationID` IS NOT NULL AND c.`QuotationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationassignment.QuotationStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationassignment` WHERE `QuotationStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationassignment.QuotationStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationStatusID` ORDER BY c.`QuotationStatusID`) AS bad_values FROM `quotationassignment` c LEFT JOIN `quotationstatus` p ON c.`QuotationStatusID` = p.`ID` WHERE c.`QuotationStatusID` IS NOT NULL AND c.`QuotationStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `quotationassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `quotationdetails` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `quotationdetails` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.PackingID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `PackingID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.PackingID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackingID` ORDER BY c.`PackingID`) AS bad_values FROM `quotationdetails` c LEFT JOIN `packing` p ON c.`PackingID` = p.`ID` WHERE c.`PackingID` IS NOT NULL AND c.`PackingID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `quotationdetails` c LEFT JOIN `companyprojectdetailcc` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.QuotationDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `QuotationDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.QuotationDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationDetailStatusID` ORDER BY c.`QuotationDetailStatusID`) AS bad_values FROM `quotationdetails` c LEFT JOIN `quotationdetailstatus` p ON c.`QuotationDetailStatusID` = p.`ID` WHERE c.`QuotationDetailStatusID` IS NOT NULL AND c.`QuotationDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.QuotationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `QuotationID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.QuotationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationID` ORDER BY c.`QuotationID`) AS bad_values FROM `quotationdetails` c LEFT JOIN `quotation` p ON c.`QuotationID` = p.`ID` WHERE c.`QuotationID` IS NOT NULL AND c.`QuotationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.QuotationPackID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `QuotationPackID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.QuotationPackID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationPackID` ORDER BY c.`QuotationPackID`) AS bad_values FROM `quotationdetails` c LEFT JOIN `quotationpack` p ON c.`QuotationPackID` = p.`ID` WHERE c.`QuotationPackID` IS NOT NULL AND c.`QuotationPackID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `quotationdetails` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetails.SatuanOrderQty' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetails` WHERE `SatuanOrderQty` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.SatuanOrderQty' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanOrderQty` ORDER BY c.`SatuanOrderQty`) AS bad_values FROM `quotationdetails` c LEFT JOIN `satuan` p ON c.`SatuanOrderQty` = p.`ID` WHERE c.`SatuanOrderQty` IS NOT NULL AND c.`SatuanOrderQty` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetailsassignment.QuotationDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetailsassignment` WHERE `QuotationDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetailsassignment.QuotationDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationDetailID` ORDER BY c.`QuotationDetailID`) AS bad_values FROM `quotationdetailsassignment` c LEFT JOIN `quotationdetails` p ON c.`QuotationDetailID` = p.`ID` WHERE c.`QuotationDetailID` IS NOT NULL AND c.`QuotationDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetailsassignment.QuotationDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetailsassignment` WHERE `QuotationDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetailsassignment.QuotationDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationDetailStatusID` ORDER BY c.`QuotationDetailStatusID`) AS bad_values FROM `quotationdetailsassignment` c LEFT JOIN `quotationdetailstatus` p ON c.`QuotationDetailStatusID` = p.`ID` WHERE c.`QuotationDetailStatusID` IS NOT NULL AND c.`QuotationDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetailsassignment.QuotationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetailsassignment` WHERE `QuotationID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetailsassignment.QuotationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationID` ORDER BY c.`QuotationID`) AS bad_values FROM `quotationdetailsassignment` c LEFT JOIN `quotation` p ON c.`QuotationID` = p.`ID` WHERE c.`QuotationID` IS NOT NULL AND c.`QuotationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationdetailsassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationdetailsassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationdetailsassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `quotationdetailsassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'quotationlink.QuotationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `quotationlink` WHERE `QuotationID` = 0 HAVING COUNT(*) > 0;
SELECT 'quotationlink.QuotationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`QuotationID` ORDER BY c.`QuotationID`) AS bad_values FROM `quotationlink` c LEFT JOIN `quotation` p ON c.`QuotationID` = p.`ID` WHERE c.`QuotationID` IS NOT NULL AND c.`QuotationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'reference.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `reference` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'reference.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `reference` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'referencehistory.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `referencehistory` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'referencehistory.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `referencehistory` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'referencehistory.ReferenceID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `referencehistory` WHERE `ReferenceID` = 0 HAVING COUNT(*) > 0;
SELECT 'referencehistory.ReferenceID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ReferenceID` ORDER BY c.`ReferenceID`) AS bad_values FROM `referencehistory` c LEFT JOIN `reference` p ON c.`ReferenceID` = p.`ID` WHERE c.`ReferenceID` IS NOT NULL AND c.`ReferenceID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'referencehistory.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `referencehistory` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'referencehistory.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `referencehistory` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'relabelhistory.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `relabelhistory` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'relabelhistory.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `relabelhistory` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'rolegadget.GadgetID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `rolegadget` WHERE `GadgetID` = 0 HAVING COUNT(*) > 0;
SELECT 'rolegadget.GadgetID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`GadgetID` ORDER BY c.`GadgetID`) AS bad_values FROM `rolegadget` c LEFT JOIN `gadget` p ON c.`GadgetID` = p.`ID` WHERE c.`GadgetID` IS NOT NULL AND c.`GadgetID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'rolegadget.RoleID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `rolegadget` WHERE `RoleID` = 0 HAVING COUNT(*) > 0;
SELECT 'rolegadget.RoleID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`RoleID` ORDER BY c.`RoleID`) AS bad_values FROM `rolegadget` c LEFT JOIN `role` p ON c.`RoleID` = p.`ID` WHERE c.`RoleID` IS NOT NULL AND c.`RoleID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'rolemenu.MenuID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `rolemenu` WHERE `MenuID` = 0 HAVING COUNT(*) > 0;
SELECT 'rolemenu.MenuID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`MenuID` ORDER BY c.`MenuID`) AS bad_values FROM `rolemenu` c LEFT JOIN `menu` p ON c.`MenuID` = p.`ID` WHERE c.`MenuID` IS NOT NULL AND c.`MenuID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'rolemenu.RoleID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `rolemenu` WHERE `RoleID` = 0 HAVING COUNT(*) > 0;
SELECT 'rolemenu.RoleID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`RoleID` ORDER BY c.`RoleID`) AS bad_values FROM `rolemenu` c LEFT JOIN `role` p ON c.`RoleID` = p.`ID` WHERE c.`RoleID` IS NOT NULL AND c.`RoleID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebate.CCPaymentTerm' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebate` WHERE `CCPaymentTerm` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebate.CCPaymentTerm' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CCPaymentTerm` ORDER BY c.`CCPaymentTerm`) AS bad_values FROM `salesrebate` c LEFT JOIN `quotationpaymentterm` p ON c.`CCPaymentTerm` = p.`ID` WHERE c.`CCPaymentTerm` IS NOT NULL AND c.`CCPaymentTerm` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebate.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebate` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebate.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `salesrebate` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebate.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebate` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebate.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `salesrebate` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebate.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebate` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebate.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `salesrebate` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebate.ReferenceRebateID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebate` WHERE `ReferenceRebateID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebate.ReferenceRebateID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ReferenceRebateID` ORDER BY c.`ReferenceRebateID`) AS bad_values FROM `salesrebate` c LEFT JOIN `salesrebate` p ON c.`ReferenceRebateID` = p.`ID` WHERE c.`ReferenceRebateID` IS NOT NULL AND c.`ReferenceRebateID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebate.SalesRebateStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebate` WHERE `SalesRebateStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebate.SalesRebateStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateStatusID` ORDER BY c.`SalesRebateStatusID`) AS bad_values FROM `salesrebate` c LEFT JOIN `salesrebatestatus` p ON c.`SalesRebateStatusID` = p.`ID` WHERE c.`SalesRebateStatusID` IS NOT NULL AND c.`SalesRebateStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebate.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebate` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebate.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `salesrebate` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebate.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebate` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebate.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `salesrebate` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateassignment.SalesRebateID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateassignment` WHERE `SalesRebateID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateassignment.SalesRebateID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateID` ORDER BY c.`SalesRebateID`) AS bad_values FROM `salesrebateassignment` c LEFT JOIN `salesrebate` p ON c.`SalesRebateID` = p.`ID` WHERE c.`SalesRebateID` IS NOT NULL AND c.`SalesRebateID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateassignment.SalesRebateStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateassignment` WHERE `SalesRebateStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateassignment.SalesRebateStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateStatusID` ORDER BY c.`SalesRebateStatusID`) AS bad_values FROM `salesrebateassignment` c LEFT JOIN `salesrebatestatus` p ON c.`SalesRebateStatusID` = p.`ID` WHERE c.`SalesRebateStatusID` IS NOT NULL AND c.`SalesRebateStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `salesrebateassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebatedetail.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebatedetail` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebatedetail.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `salesrebatedetail` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebatedetail.SalesRebateID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebatedetail` WHERE `SalesRebateID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebatedetail.SalesRebateID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateID` ORDER BY c.`SalesRebateID`) AS bad_values FROM `salesrebatedetail` c LEFT JOIN `salesrebate` p ON c.`SalesRebateID` = p.`ID` WHERE c.`SalesRebateID` IS NOT NULL AND c.`SalesRebateID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoice` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `salesrebateinvoice` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoice` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `salesrebateinvoice` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoice` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `salesrebateinvoice` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.SalesRebateID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoice` WHERE `SalesRebateID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.SalesRebateID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateID` ORDER BY c.`SalesRebateID`) AS bad_values FROM `salesrebateinvoice` c LEFT JOIN `salesrebate` p ON c.`SalesRebateID` = p.`ID` WHERE c.`SalesRebateID` IS NOT NULL AND c.`SalesRebateID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.SalesRebateInvoiceStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoice` WHERE `SalesRebateInvoiceStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.SalesRebateInvoiceStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateInvoiceStatusID` ORDER BY c.`SalesRebateInvoiceStatusID`) AS bad_values FROM `salesrebateinvoice` c LEFT JOIN `salesrebateinvoicedetailstatus` p ON c.`SalesRebateInvoiceStatusID` = p.`ID` WHERE c.`SalesRebateInvoiceStatusID` IS NOT NULL AND c.`SalesRebateInvoiceStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.UserInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoice` WHERE `UserInput` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoice.UserInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserInput` ORDER BY c.`UserInput`) AS bad_values FROM `salesrebateinvoice` c LEFT JOIN `users` p ON c.`UserInput` = p.`ID` WHERE c.`UserInput` IS NOT NULL AND c.`UserInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoiceassignment.SalesRebateInvoiceID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoiceassignment` WHERE `SalesRebateInvoiceID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoiceassignment.SalesRebateInvoiceID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateInvoiceID` ORDER BY c.`SalesRebateInvoiceID`) AS bad_values FROM `salesrebateinvoiceassignment` c LEFT JOIN `salesrebateinvoice` p ON c.`SalesRebateInvoiceID` = p.`ID` WHERE c.`SalesRebateInvoiceID` IS NOT NULL AND c.`SalesRebateInvoiceID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoiceassignment.SalesRebateInvoiceStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoiceassignment` WHERE `SalesRebateInvoiceStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoiceassignment.SalesRebateInvoiceStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateInvoiceStatusID` ORDER BY c.`SalesRebateInvoiceStatusID`) AS bad_values FROM `salesrebateinvoiceassignment` c LEFT JOIN `salesrebateinvoicedetailstatus` p ON c.`SalesRebateInvoiceStatusID` = p.`ID` WHERE c.`SalesRebateInvoiceStatusID` IS NOT NULL AND c.`SalesRebateInvoiceStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoiceassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoiceassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoiceassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `salesrebateinvoiceassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicedetail.PaymentCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoicedetail` WHERE `PaymentCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicedetail.PaymentCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PaymentCPID` ORDER BY c.`PaymentCPID`) AS bad_values FROM `salesrebateinvoicedetail` c LEFT JOIN `companycp` p ON c.`PaymentCPID` = p.`ID` WHERE c.`PaymentCPID` IS NOT NULL AND c.`PaymentCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicedetail.SalesRebateID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoicedetail` WHERE `SalesRebateID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicedetail.SalesRebateID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateID` ORDER BY c.`SalesRebateID`) AS bad_values FROM `salesrebateinvoicedetail` c LEFT JOIN `salesrebate` p ON c.`SalesRebateID` = p.`ID` WHERE c.`SalesRebateID` IS NOT NULL AND c.`SalesRebateID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicedetail.SalesRebateInvoiceDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoicedetail` WHERE `SalesRebateInvoiceDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicedetail.SalesRebateInvoiceDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateInvoiceDetailStatusID` ORDER BY c.`SalesRebateInvoiceDetailStatusID`) AS bad_values FROM `salesrebateinvoicedetail` c LEFT JOIN `salesrebateinvoicedetailstatus` p ON c.`SalesRebateInvoiceDetailStatusID` = p.`ID` WHERE c.`SalesRebateInvoiceDetailStatusID` IS NOT NULL AND c.`SalesRebateInvoiceDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicedetail.SalesRebateInvoiceID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoicedetail` WHERE `SalesRebateInvoiceID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicedetail.SalesRebateInvoiceID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateInvoiceID` ORDER BY c.`SalesRebateInvoiceID`) AS bad_values FROM `salesrebateinvoicedetail` c LEFT JOIN `salesrebateinvoice` p ON c.`SalesRebateInvoiceID` = p.`ID` WHERE c.`SalesRebateInvoiceID` IS NOT NULL AND c.`SalesRebateInvoiceID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicepaymentdetail.SalesRebateInvoiceDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `salesrebateinvoicepaymentdetail` WHERE `SalesRebateInvoiceDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'salesrebateinvoicepaymentdetail.SalesRebateInvoiceDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SalesRebateInvoiceDetailID` ORDER BY c.`SalesRebateInvoiceDetailID`) AS bad_values FROM `salesrebateinvoicepaymentdetail` c LEFT JOIN `salesrebateinvoicedetail` p ON c.`SalesRebateInvoiceDetailID` = p.`ID` WHERE c.`SalesRebateInvoiceDetailID` IS NOT NULL AND c.`SalesRebateInvoiceDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `sampleorder` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `sampleorder` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.DeliveryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `DeliveryID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.DeliveryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DeliveryID` ORDER BY c.`DeliveryID`) AS bad_values FROM `sampleorder` c LEFT JOIN `delivery` p ON c.`DeliveryID` = p.`ID` WHERE c.`DeliveryID` IS NOT NULL AND c.`DeliveryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `sampleorder` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.IndustryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `IndustryID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.IndustryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`IndustryID` ORDER BY c.`IndustryID`) AS bad_values FROM `sampleorder` c LEFT JOIN `industry` p ON c.`IndustryID` = p.`ID` WHERE c.`IndustryID` IS NOT NULL AND c.`IndustryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.LocationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `LocationID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.LocationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LocationID` ORDER BY c.`LocationID`) AS bad_values FROM `sampleorder` c LEFT JOIN `location` p ON c.`LocationID` = p.`ID` WHERE c.`LocationID` IS NOT NULL AND c.`LocationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.PriorityID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `PriorityID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.PriorityID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PriorityID` ORDER BY c.`PriorityID`) AS bad_values FROM `sampleorder` c LEFT JOIN `priority` p ON c.`PriorityID` = p.`ID` WHERE c.`PriorityID` IS NOT NULL AND c.`PriorityID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `sampleorder` c LEFT JOIN `companyproject` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.ReferenceSOID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `ReferenceSOID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.ReferenceSOID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ReferenceSOID` ORDER BY c.`ReferenceSOID`) AS bad_values FROM `sampleorder` c LEFT JOIN `sampleorder` p ON c.`ReferenceSOID` = p.`ID` WHERE c.`ReferenceSOID` IS NOT NULL AND c.`ReferenceSOID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.SampleOrderByID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `SampleOrderByID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.SampleOrderByID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderByID` ORDER BY c.`SampleOrderByID`) AS bad_values FROM `sampleorder` c LEFT JOIN `sampleorderby` p ON c.`SampleOrderByID` = p.`ID` WHERE c.`SampleOrderByID` IS NOT NULL AND c.`SampleOrderByID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.SampleOrderFeedbackStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `SampleOrderFeedbackStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.SampleOrderFeedbackStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderFeedbackStatusID` ORDER BY c.`SampleOrderFeedbackStatusID`) AS bad_values FROM `sampleorder` c LEFT JOIN `sampleorderfeedbackstatus` p ON c.`SampleOrderFeedbackStatusID` = p.`ID` WHERE c.`SampleOrderFeedbackStatusID` IS NOT NULL AND c.`SampleOrderFeedbackStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.SampleOrderStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `SampleOrderStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.SampleOrderStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderStatusID` ORDER BY c.`SampleOrderStatusID`) AS bad_values FROM `sampleorder` c LEFT JOIN `sampleorderstatus` p ON c.`SampleOrderStatusID` = p.`ID` WHERE c.`SampleOrderStatusID` IS NOT NULL AND c.`SampleOrderStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `sampleorder` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorder.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorder` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorder.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `sampleorder` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderassignment.SampleOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderassignment` WHERE `SampleOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderassignment.SampleOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderID` ORDER BY c.`SampleOrderID`) AS bad_values FROM `sampleorderassignment` c LEFT JOIN `sampleorder` p ON c.`SampleOrderID` = p.`ID` WHERE c.`SampleOrderID` IS NOT NULL AND c.`SampleOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderassignment.SampleOrderStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderassignment` WHERE `SampleOrderStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderassignment.SampleOrderStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderStatusID` ORDER BY c.`SampleOrderStatusID`) AS bad_values FROM `sampleorderassignment` c LEFT JOIN `sampleorderstatus` p ON c.`SampleOrderStatusID` = p.`ID` WHERE c.`SampleOrderStatusID` IS NOT NULL AND c.`SampleOrderStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `sampleorderassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.BarangListID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `BarangListID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.BarangListID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangListID` ORDER BY c.`BarangListID`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `baranglists` p ON c.`BarangListID` = p.`ID` WHERE c.`BarangListID` IS NOT NULL AND c.`BarangListID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.BarangListIDRequest' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `BarangListIDRequest` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.BarangListIDRequest' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangListIDRequest` ORDER BY c.`BarangListIDRequest`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `baranglists` p ON c.`BarangListIDRequest` = p.`ID` WHERE c.`BarangListIDRequest` IS NOT NULL AND c.`BarangListIDRequest` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `companyprojectdetailcc` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.SampleOrderDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `SampleOrderDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.SampleOrderDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderDetailStatusID` ORDER BY c.`SampleOrderDetailStatusID`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `sampleorderdetailstatus` p ON c.`SampleOrderDetailStatusID` = p.`ID` WHERE c.`SampleOrderDetailStatusID` IS NOT NULL AND c.`SampleOrderDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.SampleOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `SampleOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.SampleOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderID` ORDER BY c.`SampleOrderID`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `sampleorder` p ON c.`SampleOrderID` = p.`ID` WHERE c.`SampleOrderID` IS NOT NULL AND c.`SampleOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.SuratJalanDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetail` WHERE `SuratJalanDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetail.SuratJalanDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SuratJalanDetailID` ORDER BY c.`SuratJalanDetailID`) AS bad_values FROM `sampleorderdetail` c LEFT JOIN `suratjalandetails` p ON c.`SuratJalanDetailID` = p.`ID` WHERE c.`SuratJalanDetailID` IS NOT NULL AND c.`SuratJalanDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetailassignment.SampleOrderDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetailassignment` WHERE `SampleOrderDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetailassignment.SampleOrderDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderDetailID` ORDER BY c.`SampleOrderDetailID`) AS bad_values FROM `sampleorderdetailassignment` c LEFT JOIN `sampleorderdetail` p ON c.`SampleOrderDetailID` = p.`ID` WHERE c.`SampleOrderDetailID` IS NOT NULL AND c.`SampleOrderDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetailassignment.SampleOrderDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetailassignment` WHERE `SampleOrderDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetailassignment.SampleOrderDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderDetailStatusID` ORDER BY c.`SampleOrderDetailStatusID`) AS bad_values FROM `sampleorderdetailassignment` c LEFT JOIN `sampleorderdetailstatus` p ON c.`SampleOrderDetailStatusID` = p.`ID` WHERE c.`SampleOrderDetailStatusID` IS NOT NULL AND c.`SampleOrderDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetailassignment.SampleOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetailassignment` WHERE `SampleOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetailassignment.SampleOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderID` ORDER BY c.`SampleOrderID`) AS bad_values FROM `sampleorderdetailassignment` c LEFT JOIN `sampleorder` p ON c.`SampleOrderID` = p.`ID` WHERE c.`SampleOrderID` IS NOT NULL AND c.`SampleOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderdetailassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderdetailassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderdetailassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `sampleorderdetailassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'sampleorderlink.SampleOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `sampleorderlink` WHERE `SampleOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'sampleorderlink.SampleOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderID` ORDER BY c.`SampleOrderID`) AS bad_values FROM `sampleorderlink` c LEFT JOIN `sampleorder` p ON c.`SampleOrderID` = p.`ID` WHERE c.`SampleOrderID` IS NOT NULL AND c.`SampleOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.DeliveryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimport` WHERE `DeliveryID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.DeliveryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DeliveryID` ORDER BY c.`DeliveryID`) AS bad_values FROM `samplerequestimport` c LEFT JOIN `delivery` p ON c.`DeliveryID` = p.`ID` WHERE c.`DeliveryID` IS NOT NULL AND c.`DeliveryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimport` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `samplerequestimport` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.ReferenceSRID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimport` WHERE `ReferenceSRID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.ReferenceSRID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ReferenceSRID` ORDER BY c.`ReferenceSRID`) AS bad_values FROM `samplerequestimport` c LEFT JOIN `samplerequestimport` p ON c.`ReferenceSRID` = p.`ID` WHERE c.`ReferenceSRID` IS NOT NULL AND c.`ReferenceSRID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.RequestFromID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimport` WHERE `RequestFromID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.RequestFromID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`RequestFromID` ORDER BY c.`RequestFromID`) AS bad_values FROM `samplerequestimport` c LEFT JOIN `samplerequestimportfrom` p ON c.`RequestFromID` = p.`ID` WHERE c.`RequestFromID` IS NOT NULL AND c.`RequestFromID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.SampleRequestStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimport` WHERE `SampleRequestStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.SampleRequestStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestStatusID` ORDER BY c.`SampleRequestStatusID`) AS bad_values FROM `samplerequestimport` c LEFT JOIN `samplerequeststatus` p ON c.`SampleRequestStatusID` = p.`ID` WHERE c.`SampleRequestStatusID` IS NOT NULL AND c.`SampleRequestStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.UrgencyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimport` WHERE `UrgencyID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.UrgencyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UrgencyID` ORDER BY c.`UrgencyID`) AS bad_values FROM `samplerequestimport` c LEFT JOIN `urgency` p ON c.`UrgencyID` = p.`ID` WHERE c.`UrgencyID` IS NOT NULL AND c.`UrgencyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimport` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimport.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `samplerequestimport` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportassignment.SampleRequestImportID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportassignment` WHERE `SampleRequestImportID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportassignment.SampleRequestImportID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestImportID` ORDER BY c.`SampleRequestImportID`) AS bad_values FROM `samplerequestimportassignment` c LEFT JOIN `samplerequestimport` p ON c.`SampleRequestImportID` = p.`ID` WHERE c.`SampleRequestImportID` IS NOT NULL AND c.`SampleRequestImportID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportassignment.SampleRequestStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportassignment` WHERE `SampleRequestStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportassignment.SampleRequestStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestStatusID` ORDER BY c.`SampleRequestStatusID`) AS bad_values FROM `samplerequestimportassignment` c LEFT JOIN `samplerequeststatus` p ON c.`SampleRequestStatusID` = p.`ID` WHERE c.`SampleRequestStatusID` IS NOT NULL AND c.`SampleRequestStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `samplerequestimportassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetail` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `samplerequestimportdetail` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.BaranglistID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetail` WHERE `BaranglistID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.BaranglistID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BaranglistID` ORDER BY c.`BaranglistID`) AS bad_values FROM `samplerequestimportdetail` c LEFT JOIN `baranglists` p ON c.`BaranglistID` = p.`ID` WHERE c.`BaranglistID` IS NOT NULL AND c.`BaranglistID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.GoodReceiptDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetail` WHERE `GoodReceiptDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.GoodReceiptDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`GoodReceiptDetailID` ORDER BY c.`GoodReceiptDetailID`) AS bad_values FROM `samplerequestimportdetail` c LEFT JOIN `samplerequestimportgoodsreceipt` p ON c.`GoodReceiptDetailID` = p.`ID` WHERE c.`GoodReceiptDetailID` IS NOT NULL AND c.`GoodReceiptDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.ReqCompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetail` WHERE `ReqCompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.ReqCompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ReqCompanyID` ORDER BY c.`ReqCompanyID`) AS bad_values FROM `samplerequestimportdetail` c LEFT JOIN `company` p ON c.`ReqCompanyID` = p.`ID` WHERE c.`ReqCompanyID` IS NOT NULL AND c.`ReqCompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.SampleRequestDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetail` WHERE `SampleRequestDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.SampleRequestDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestDetailStatusID` ORDER BY c.`SampleRequestDetailStatusID`) AS bad_values FROM `samplerequestimportdetail` c LEFT JOIN `samplerequeststatus` p ON c.`SampleRequestDetailStatusID` = p.`ID` WHERE c.`SampleRequestDetailStatusID` IS NOT NULL AND c.`SampleRequestDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.SampleRequestImportID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetail` WHERE `SampleRequestImportID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.SampleRequestImportID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestImportID` ORDER BY c.`SampleRequestImportID`) AS bad_values FROM `samplerequestimportdetail` c LEFT JOIN `samplerequestimport` p ON c.`SampleRequestImportID` = p.`ID` WHERE c.`SampleRequestImportID` IS NOT NULL AND c.`SampleRequestImportID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetail` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetail.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `samplerequestimportdetail` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetailassignment.SampleRequestDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetailassignment` WHERE `SampleRequestDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetailassignment.SampleRequestDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestDetailID` ORDER BY c.`SampleRequestDetailID`) AS bad_values FROM `samplerequestimportdetailassignment` c LEFT JOIN `samplerequestimportdetail` p ON c.`SampleRequestDetailID` = p.`ID` WHERE c.`SampleRequestDetailID` IS NOT NULL AND c.`SampleRequestDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetailassignment.SampleRequestDetailStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetailassignment` WHERE `SampleRequestDetailStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetailassignment.SampleRequestDetailStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestDetailStatusID` ORDER BY c.`SampleRequestDetailStatusID`) AS bad_values FROM `samplerequestimportdetailassignment` c LEFT JOIN `samplerequeststatus` p ON c.`SampleRequestDetailStatusID` = p.`ID` WHERE c.`SampleRequestDetailStatusID` IS NOT NULL AND c.`SampleRequestDetailStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetailassignment.SampleRequestImportID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetailassignment` WHERE `SampleRequestImportID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetailassignment.SampleRequestImportID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestImportID` ORDER BY c.`SampleRequestImportID`) AS bad_values FROM `samplerequestimportdetailassignment` c LEFT JOIN `samplerequestimport` p ON c.`SampleRequestImportID` = p.`ID` WHERE c.`SampleRequestImportID` IS NOT NULL AND c.`SampleRequestImportID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetailassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportdetailassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportdetailassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `samplerequestimportdetailassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportgoodsreceipt` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `samplerequestimportgoodsreceipt` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.BarangListsID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportgoodsreceipt` WHERE `BarangListsID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.BarangListsID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangListsID` ORDER BY c.`BarangListsID`) AS bad_values FROM `samplerequestimportgoodsreceipt` c LEFT JOIN `baranglists` p ON c.`BarangListsID` = p.`ID` WHERE c.`BarangListsID` IS NOT NULL AND c.`BarangListsID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.SampleRequestImportDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportgoodsreceipt` WHERE `SampleRequestImportDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.SampleRequestImportDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestImportDetailID` ORDER BY c.`SampleRequestImportDetailID`) AS bad_values FROM `samplerequestimportgoodsreceipt` c LEFT JOIN `samplerequestimportdetail` p ON c.`SampleRequestImportDetailID` = p.`ID` WHERE c.`SampleRequestImportDetailID` IS NOT NULL AND c.`SampleRequestImportDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.SampleRequestImportID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportgoodsreceipt` WHERE `SampleRequestImportID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.SampleRequestImportID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleRequestImportID` ORDER BY c.`SampleRequestImportID`) AS bad_values FROM `samplerequestimportgoodsreceipt` c LEFT JOIN `samplerequestimport` p ON c.`SampleRequestImportID` = p.`ID` WHERE c.`SampleRequestImportID` IS NOT NULL AND c.`SampleRequestImportID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `samplerequestimportgoodsreceipt` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'samplerequestimportgoodsreceipt.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `samplerequestimportgoodsreceipt` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'specialreference.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `specialreference` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'specialreference.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `specialreference` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'specialreferencehistory.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `specialreferencehistory` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'specialreferencehistory.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `specialreferencehistory` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'specialreferencehistory.SpecialReferenceID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `specialreferencehistory` WHERE `SpecialReferenceID` = 0 HAVING COUNT(*) > 0;
SELECT 'specialreferencehistory.SpecialReferenceID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SpecialReferenceID` ORDER BY c.`SpecialReferenceID`) AS bad_values FROM `specialreferencehistory` c LEFT JOIN `specialreference` p ON c.`SpecialReferenceID` = p.`ID` WHERE c.`SpecialReferenceID` IS NOT NULL AND c.`SpecialReferenceID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'specialreferencehistory.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `specialreferencehistory` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'specialreferencehistory.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `specialreferencehistory` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname.PackagingID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname` WHERE `PackagingID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname.PackagingID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackagingID` ORDER BY c.`PackagingID`) AS bad_values FROM `stockopname` c LEFT JOIN `packing` p ON c.`PackagingID` = p.`ID` WHERE c.`PackagingID` IS NOT NULL AND c.`PackagingID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `stockopname` c LEFT JOIN `stockopname_principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname.ProductID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname` WHERE `ProductID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname.ProductID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductID` ORDER BY c.`ProductID`) AS bad_values FROM `stockopname` c LEFT JOIN `stockopname_product` p ON c.`ProductID` = p.`ID` WHERE c.`ProductID` IS NOT NULL AND c.`ProductID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname.StockOpnameBy' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname` WHERE `StockOpnameBy` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname.StockOpnameBy' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`StockOpnameBy` ORDER BY c.`StockOpnameBy`) AS bad_values FROM `stockopname` c LEFT JOIN `stockopnameby` p ON c.`StockOpnameBy` = p.`ID` WHERE c.`StockOpnameBy` IS NOT NULL AND c.`StockOpnameBy` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname.UOMID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname` WHERE `UOMID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname.UOMID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UOMID` ORDER BY c.`UOMID`) AS bad_values FROM `stockopname` c LEFT JOIN `satuan` p ON c.`UOMID` = p.`ID` WHERE c.`UOMID` IS NOT NULL AND c.`UOMID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `stockopname` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname.WarehouseID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname` WHERE `WarehouseID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname.WarehouseID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`WarehouseID` ORDER BY c.`WarehouseID`) AS bad_values FROM `stockopname` c LEFT JOIN `warehouse` p ON c.`WarehouseID` = p.`ID` WHERE c.`WarehouseID` IS NOT NULL AND c.`WarehouseID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname_product.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname_product` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname_product.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `stockopname_product` c LEFT JOIN `stockopname_principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopname_product.UOMID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopname_product` WHERE `UOMID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopname_product.UOMID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UOMID` ORDER BY c.`UOMID`) AS bad_values FROM `stockopname_product` c LEFT JOIN `satuan` p ON c.`UOMID` = p.`ID` WHERE c.`UOMID` IS NOT NULL AND c.`UOMID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.PackagingID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `PackagingID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.PackagingID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PackagingID` ORDER BY c.`PackagingID`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `packing` p ON c.`PackagingID` = p.`ID` WHERE c.`PackagingID` IS NOT NULL AND c.`PackagingID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `stockopname_principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.ProductID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `ProductID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.ProductID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProductID` ORDER BY c.`ProductID`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `stockopname_product` p ON c.`ProductID` = p.`ID` WHERE c.`ProductID` IS NOT NULL AND c.`ProductID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.StockOpnameBy' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `StockOpnameBy` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.StockOpnameBy' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`StockOpnameBy` ORDER BY c.`StockOpnameBy`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `stockopnameby` p ON c.`StockOpnameBy` = p.`ID` WHERE c.`StockOpnameBy` IS NOT NULL AND c.`StockOpnameBy` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.StockOpnameID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `StockOpnameID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.StockOpnameID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`StockOpnameID` ORDER BY c.`StockOpnameID`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `stockopname` p ON c.`StockOpnameID` = p.`ID` WHERE c.`StockOpnameID` IS NOT NULL AND c.`StockOpnameID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.StockOpnameStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `StockOpnameStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.StockOpnameStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`StockOpnameStatusID` ORDER BY c.`StockOpnameStatusID`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `stockopnamestatus` p ON c.`StockOpnameStatusID` = p.`ID` WHERE c.`StockOpnameStatusID` IS NOT NULL AND c.`StockOpnameStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.UOMID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `UOMID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.UOMID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UOMID` ORDER BY c.`UOMID`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `satuan` p ON c.`UOMID` = p.`ID` WHERE c.`UOMID` IS NOT NULL AND c.`UOMID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.WarehouseID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `stockopnamehistory` WHERE `WarehouseID` = 0 HAVING COUNT(*) > 0;
SELECT 'stockopnamehistory.WarehouseID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`WarehouseID` ORDER BY c.`WarehouseID`) AS bad_values FROM `stockopnamehistory` c LEFT JOIN `warehouse` p ON c.`WarehouseID` = p.`ID` WHERE c.`WarehouseID` IS NOT NULL AND c.`WarehouseID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstory.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstory` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'successstory.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `successstory` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstory.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstory` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'successstory.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `successstory` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstory.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstory` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'successstory.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `successstory` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstory.GroupDivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstory` WHERE `GroupDivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'successstory.GroupDivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`GroupDivisionID` ORDER BY c.`GroupDivisionID`) AS bad_values FROM `successstory` c LEFT JOIN `groupdivision` p ON c.`GroupDivisionID` = p.`ID` WHERE c.`GroupDivisionID` IS NOT NULL AND c.`GroupDivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstory.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstory` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'successstory.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `successstory` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstory.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstory` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'successstory.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `successstory` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstory.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstory` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'successstory.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `successstory` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstoryassignment.SuccessStoryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstoryassignment` WHERE `SuccessStoryID` = 0 HAVING COUNT(*) > 0;
SELECT 'successstoryassignment.SuccessStoryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SuccessStoryID` ORDER BY c.`SuccessStoryID`) AS bad_values FROM `successstoryassignment` c LEFT JOIN `successstory` p ON c.`SuccessStoryID` = p.`ID` WHERE c.`SuccessStoryID` IS NOT NULL AND c.`SuccessStoryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'successstoryassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `successstoryassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'successstoryassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `successstoryassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalan.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalan` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalan.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `suratjalan` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalan.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalan` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalan.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `suratjalan` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalan.DeliveryID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalan` WHERE `DeliveryID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalan.DeliveryID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DeliveryID` ORDER BY c.`DeliveryID`) AS bad_values FROM `suratjalan` c LEFT JOIN `delivery` p ON c.`DeliveryID` = p.`ID` WHERE c.`DeliveryID` IS NOT NULL AND c.`DeliveryID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalan.LocationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalan` WHERE `LocationID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalan.LocationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`LocationID` ORDER BY c.`LocationID`) AS bad_values FROM `suratjalan` c LEFT JOIN `location` p ON c.`LocationID` = p.`ID` WHERE c.`LocationID` IS NOT NULL AND c.`LocationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalan.SampleOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalan` WHERE `SampleOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalan.SampleOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderID` ORDER BY c.`SampleOrderID`) AS bad_values FROM `suratjalan` c LEFT JOIN `sampleorder` p ON c.`SampleOrderID` = p.`ID` WHERE c.`SampleOrderID` IS NOT NULL AND c.`SampleOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalan.UserIDCreatorSJ' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalan` WHERE `UserIDCreatorSJ` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalan.UserIDCreatorSJ' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDCreatorSJ` ORDER BY c.`UserIDCreatorSJ`) AS bad_values FROM `suratjalan` c LEFT JOIN `users` p ON c.`UserIDCreatorSJ` = p.`ID` WHERE c.`UserIDCreatorSJ` IS NOT NULL AND c.`UserIDCreatorSJ` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalan.UserIDsales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalan` WHERE `UserIDsales` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalan.UserIDsales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDsales` ORDER BY c.`UserIDsales`) AS bad_values FROM `suratjalan` c LEFT JOIN `users` p ON c.`UserIDsales` = p.`ID` WHERE c.`UserIDsales` IS NOT NULL AND c.`UserIDsales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.ApplicationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalandetails` WHERE `ApplicationID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.ApplicationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ApplicationID` ORDER BY c.`ApplicationID`) AS bad_values FROM `suratjalandetails` c LEFT JOIN `application` p ON c.`ApplicationID` = p.`ID` WHERE c.`ApplicationID` IS NOT NULL AND c.`ApplicationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalandetails` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `suratjalandetails` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.BarangListID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalandetails` WHERE `BarangListID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.BarangListID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangListID` ORDER BY c.`BarangListID`) AS bad_values FROM `suratjalandetails` c LEFT JOIN `baranglists` p ON c.`BarangListID` = p.`ID` WHERE c.`BarangListID` IS NOT NULL AND c.`BarangListID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.SampleOrderID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalandetails` WHERE `SampleOrderID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.SampleOrderID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SampleOrderID` ORDER BY c.`SampleOrderID`) AS bad_values FROM `suratjalandetails` c LEFT JOIN `sampleorder` p ON c.`SampleOrderID` = p.`ID` WHERE c.`SampleOrderID` IS NOT NULL AND c.`SampleOrderID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.SatuanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalandetails` WHERE `SatuanID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.SatuanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SatuanID` ORDER BY c.`SatuanID`) AS bad_values FROM `suratjalandetails` c LEFT JOIN `satuan` p ON c.`SatuanID` = p.`ID` WHERE c.`SatuanID` IS NOT NULL AND c.`SatuanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.SuratJalanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `suratjalandetails` WHERE `SuratJalanID` = 0 HAVING COUNT(*) > 0;
SELECT 'suratjalandetails.SuratJalanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`SuratJalanID` ORDER BY c.`SuratJalanID`) AS bad_values FROM `suratjalandetails` c LEFT JOIN `suratjalan` p ON c.`SuratJalanID` = p.`ID` WHERE c.`SuratJalanID` IS NOT NULL AND c.`SuratJalanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userbusinesstravelbranch.BranchID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userbusinesstravelbranch` WHERE `BranchID` = 0 HAVING COUNT(*) > 0;
SELECT 'userbusinesstravelbranch.BranchID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BranchID` ORDER BY c.`BranchID`) AS bad_values FROM `userbusinesstravelbranch` c LEFT JOIN `branch` p ON c.`BranchID` = p.`ID` WHERE c.`BranchID` IS NOT NULL AND c.`BranchID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userbusinesstravelbranch.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userbusinesstravelbranch` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'userbusinesstravelbranch.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `userbusinesstravelbranch` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userdetails.BranchID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userdetails` WHERE `BranchID` = 0 HAVING COUNT(*) > 0;
SELECT 'userdetails.BranchID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BranchID` ORDER BY c.`BranchID`) AS bad_values FROM `userdetails` c LEFT JOIN `branch` p ON c.`BranchID` = p.`ID` WHERE c.`BranchID` IS NOT NULL AND c.`BranchID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userdetails.DepartmentID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userdetails` WHERE `DepartmentID` = 0 HAVING COUNT(*) > 0;
SELECT 'userdetails.DepartmentID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DepartmentID` ORDER BY c.`DepartmentID`) AS bad_values FROM `userdetails` c LEFT JOIN `department` p ON c.`DepartmentID` = p.`ID` WHERE c.`DepartmentID` IS NOT NULL AND c.`DepartmentID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userdetails.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userdetails` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'userdetails.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `userdetails` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userdivision.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userdivision` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'userdivision.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `userdivision` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userdivision.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userdivision` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'userdivision.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `userdivision` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'usereducation.EducationID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `usereducation` WHERE `EducationID` = 0 HAVING COUNT(*) > 0;
SELECT 'usereducation.EducationID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`EducationID` ORDER BY c.`EducationID`) AS bad_values FROM `usereducation` c LEFT JOIN `education` p ON c.`EducationID` = p.`ID` WHERE c.`EducationID` IS NOT NULL AND c.`EducationID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'usereducation.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `usereducation` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'usereducation.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `usereducation` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userjob.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userjob` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'userjob.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `userjob` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userlabgroupdivision.GroupDivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userlabgroupdivision` WHERE `GroupDivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'userlabgroupdivision.GroupDivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`GroupDivisionID` ORDER BY c.`GroupDivisionID`) AS bad_values FROM `userlabgroupdivision` c LEFT JOIN `groupdivision` p ON c.`GroupDivisionID` = p.`ID` WHERE c.`GroupDivisionID` IS NOT NULL AND c.`GroupDivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userlabgroupdivision.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userlabgroupdivision` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'userlabgroupdivision.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `userlabgroupdivision` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userprincipal.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userprincipal` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'userprincipal.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `userprincipal` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userprincipal.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userprincipal` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'userprincipal.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `userprincipal` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'users.BranchID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `users` WHERE `BranchID` = 0 HAVING COUNT(*) > 0;
SELECT 'users.BranchID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BranchID` ORDER BY c.`BranchID`) AS bad_values FROM `users` c LEFT JOIN `branch` p ON c.`BranchID` = p.`ID` WHERE c.`BranchID` IS NOT NULL AND c.`BranchID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'users.DepartmentID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `users` WHERE `DepartmentID` = 0 HAVING COUNT(*) > 0;
SELECT 'users.DepartmentID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DepartmentID` ORDER BY c.`DepartmentID`) AS bad_values FROM `users` c LEFT JOIN `department` p ON c.`DepartmentID` = p.`ID` WHERE c.`DepartmentID` IS NOT NULL AND c.`DepartmentID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'users.HeadID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `users` WHERE `HeadID` = 0 HAVING COUNT(*) > 0;
SELECT 'users.HeadID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`HeadID` ORDER BY c.`HeadID`) AS bad_values FROM `users` c LEFT JOIN `users` p ON c.`HeadID` = p.`ID` WHERE c.`HeadID` IS NOT NULL AND c.`HeadID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'users.MaritalStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `users` WHERE `MaritalStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'users.MaritalStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`MaritalStatusID` ORDER BY c.`MaritalStatusID`) AS bad_values FROM `users` c LEFT JOIN `maritalstatus` p ON c.`MaritalStatusID` = p.`ID` WHERE c.`MaritalStatusID` IS NOT NULL AND c.`MaritalStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'users.RoleID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `users` WHERE `RoleID` = 0 HAVING COUNT(*) > 0;
SELECT 'users.RoleID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`RoleID` ORDER BY c.`RoleID`) AS bad_values FROM `users` c LEFT JOIN `role` p ON c.`RoleID` = p.`ID` WHERE c.`RoleID` IS NOT NULL AND c.`RoleID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'usersperiode.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `usersperiode` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'usersperiode.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `usersperiode` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userwarehouse.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userwarehouse` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'userwarehouse.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `userwarehouse` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'userwarehouse.WarehouseID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `userwarehouse` WHERE `WarehouseID` = 0 HAVING COUNT(*) > 0;
SELECT 'userwarehouse.WarehouseID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`WarehouseID` ORDER BY c.`WarehouseID`) AS bad_values FROM `userwarehouse` c LEFT JOIN `warehouse` p ON c.`WarehouseID` = p.`ID` WHERE c.`WarehouseID` IS NOT NULL AND c.`WarehouseID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicle.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicle` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicle.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `vehicle` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicle.UserIDOwner' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicle` WHERE `UserIDOwner` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicle.UserIDOwner' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDOwner` ORDER BY c.`UserIDOwner`) AS bad_values FROM `vehicle` c LEFT JOIN `users` p ON c.`UserIDOwner` = p.`ID` WHERE c.`UserIDOwner` IS NOT NULL AND c.`UserIDOwner` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleBrandID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicle` WHERE `VehicleBrandID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleBrandID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleBrandID` ORDER BY c.`VehicleBrandID`) AS bad_values FROM `vehicle` c LEFT JOIN `vehiclebrand` p ON c.`VehicleBrandID` = p.`ID` WHERE c.`VehicleBrandID` IS NOT NULL AND c.`VehicleBrandID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleBrandTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicle` WHERE `VehicleBrandTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleBrandTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleBrandTypeID` ORDER BY c.`VehicleBrandTypeID`) AS bad_values FROM `vehicle` c LEFT JOIN `vehiclebrandtype` p ON c.`VehicleBrandTypeID` = p.`ID` WHERE c.`VehicleBrandTypeID` IS NOT NULL AND c.`VehicleBrandTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleColorID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicle` WHERE `VehicleColorID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleColorID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleColorID` ORDER BY c.`VehicleColorID`) AS bad_values FROM `vehicle` c LEFT JOIN `vehiclecolor` p ON c.`VehicleColorID` = p.`ID` WHERE c.`VehicleColorID` IS NOT NULL AND c.`VehicleColorID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleFuelTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicle` WHERE `VehicleFuelTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleFuelTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleFuelTypeID` ORDER BY c.`VehicleFuelTypeID`) AS bad_values FROM `vehicle` c LEFT JOIN `vehiclefueltype` p ON c.`VehicleFuelTypeID` = p.`ID` WHERE c.`VehicleFuelTypeID` IS NOT NULL AND c.`VehicleFuelTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicle` WHERE `VehicleTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicle.VehicleTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleTypeID` ORDER BY c.`VehicleTypeID`) AS bad_values FROM `vehicle` c LEFT JOIN `vehicletype` p ON c.`VehicleTypeID` = p.`ID` WHERE c.`VehicleTypeID` IS NOT NULL AND c.`VehicleTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.UserIDOwnerAfter' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `UserIDOwnerAfter` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.UserIDOwnerAfter' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDOwnerAfter` ORDER BY c.`UserIDOwnerAfter`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `users` p ON c.`UserIDOwnerAfter` = p.`ID` WHERE c.`UserIDOwnerAfter` IS NOT NULL AND c.`UserIDOwnerAfter` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.UserIDOwnerBefore' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `UserIDOwnerBefore` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.UserIDOwnerBefore' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDOwnerBefore` ORDER BY c.`UserIDOwnerBefore`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `users` p ON c.`UserIDOwnerBefore` = p.`ID` WHERE c.`UserIDOwnerBefore` IS NOT NULL AND c.`UserIDOwnerBefore` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleBrandIDAfter' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleBrandIDAfter` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleBrandIDAfter' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleBrandIDAfter` ORDER BY c.`VehicleBrandIDAfter`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclebrand` p ON c.`VehicleBrandIDAfter` = p.`ID` WHERE c.`VehicleBrandIDAfter` IS NOT NULL AND c.`VehicleBrandIDAfter` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleBrandIDBefore' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleBrandIDBefore` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleBrandIDBefore' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleBrandIDBefore` ORDER BY c.`VehicleBrandIDBefore`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclebrand` p ON c.`VehicleBrandIDBefore` = p.`ID` WHERE c.`VehicleBrandIDBefore` IS NOT NULL AND c.`VehicleBrandIDBefore` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleBrandTypeIDAfter' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleBrandTypeIDAfter` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleBrandTypeIDAfter' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleBrandTypeIDAfter` ORDER BY c.`VehicleBrandTypeIDAfter`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclebrandtype` p ON c.`VehicleBrandTypeIDAfter` = p.`ID` WHERE c.`VehicleBrandTypeIDAfter` IS NOT NULL AND c.`VehicleBrandTypeIDAfter` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleBrandTypeIDBefore' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleBrandTypeIDBefore` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleBrandTypeIDBefore' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleBrandTypeIDBefore` ORDER BY c.`VehicleBrandTypeIDBefore`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclebrandtype` p ON c.`VehicleBrandTypeIDBefore` = p.`ID` WHERE c.`VehicleBrandTypeIDBefore` IS NOT NULL AND c.`VehicleBrandTypeIDBefore` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleColorIDAfter' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleColorIDAfter` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleColorIDAfter' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleColorIDAfter` ORDER BY c.`VehicleColorIDAfter`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclecolor` p ON c.`VehicleColorIDAfter` = p.`ID` WHERE c.`VehicleColorIDAfter` IS NOT NULL AND c.`VehicleColorIDAfter` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleColorIDBefore' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleColorIDBefore` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleColorIDBefore' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleColorIDBefore` ORDER BY c.`VehicleColorIDBefore`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclecolor` p ON c.`VehicleColorIDBefore` = p.`ID` WHERE c.`VehicleColorIDBefore` IS NOT NULL AND c.`VehicleColorIDBefore` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleFuelTypeIDAfter' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleFuelTypeIDAfter` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleFuelTypeIDAfter' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleFuelTypeIDAfter` ORDER BY c.`VehicleFuelTypeIDAfter`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclefueltype` p ON c.`VehicleFuelTypeIDAfter` = p.`ID` WHERE c.`VehicleFuelTypeIDAfter` IS NOT NULL AND c.`VehicleFuelTypeIDAfter` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleFuelTypeIDBefore' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleFuelTypeIDBefore` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleFuelTypeIDBefore' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleFuelTypeIDBefore` ORDER BY c.`VehicleFuelTypeIDBefore`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclefueltype` p ON c.`VehicleFuelTypeIDBefore` = p.`ID` WHERE c.`VehicleFuelTypeIDBefore` IS NOT NULL AND c.`VehicleFuelTypeIDBefore` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleID` ORDER BY c.`VehicleID`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehicle` p ON c.`VehicleID` = p.`ID` WHERE c.`VehicleID` IS NOT NULL AND c.`VehicleID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleStatusID` ORDER BY c.`VehicleStatusID`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehiclestatus` p ON c.`VehicleStatusID` = p.`ID` WHERE c.`VehicleStatusID` IS NOT NULL AND c.`VehicleStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleTypeIDAfter' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleTypeIDAfter` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleTypeIDAfter' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleTypeIDAfter` ORDER BY c.`VehicleTypeIDAfter`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehicletype` p ON c.`VehicleTypeIDAfter` = p.`ID` WHERE c.`VehicleTypeIDAfter` IS NOT NULL AND c.`VehicleTypeIDAfter` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleTypeIDBefore' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleassignment` WHERE `VehicleTypeIDBefore` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleassignment.VehicleTypeIDBefore' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleTypeIDBefore` ORDER BY c.`VehicleTypeIDBefore`) AS bad_values FROM `vehicleassignment` c LEFT JOIN `vehicletype` p ON c.`VehicleTypeIDBefore` = p.`ID` WHERE c.`VehicleTypeIDBefore` IS NOT NULL AND c.`VehicleTypeIDBefore` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehiclebrandtype.VehicleBrandID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehiclebrandtype` WHERE `VehicleBrandID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehiclebrandtype.VehicleBrandID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleBrandID` ORDER BY c.`VehicleBrandID`) AS bad_values FROM `vehiclebrandtype` c LEFT JOIN `vehiclebrand` p ON c.`VehicleBrandID` = p.`ID` WHERE c.`VehicleBrandID` IS NOT NULL AND c.`VehicleBrandID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequest.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequest` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequest.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `vehicleservicerequest` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequest.UserIDOwner' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequest` WHERE `UserIDOwner` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequest.UserIDOwner' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDOwner` ORDER BY c.`UserIDOwner`) AS bad_values FROM `vehicleservicerequest` c LEFT JOIN `users` p ON c.`UserIDOwner` = p.`ID` WHERE c.`UserIDOwner` IS NOT NULL AND c.`UserIDOwner` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequest.VehicleID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequest` WHERE `VehicleID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequest.VehicleID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleID` ORDER BY c.`VehicleID`) AS bad_values FROM `vehicleservicerequest` c LEFT JOIN `vehicle` p ON c.`VehicleID` = p.`ID` WHERE c.`VehicleID` IS NOT NULL AND c.`VehicleID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequest.VehicleServiceRequestStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequest` WHERE `VehicleServiceRequestStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequest.VehicleServiceRequestStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceRequestStatusID` ORDER BY c.`VehicleServiceRequestStatusID`) AS bad_values FROM `vehicleservicerequest` c LEFT JOIN `vehicleservicerequeststatus` p ON c.`VehicleServiceRequestStatusID` = p.`ID` WHERE c.`VehicleServiceRequestStatusID` IS NOT NULL AND c.`VehicleServiceRequestStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `vehicleservicerequestassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestassignment.VehicleServiceRequestID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestassignment` WHERE `VehicleServiceRequestID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestassignment.VehicleServiceRequestID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceRequestID` ORDER BY c.`VehicleServiceRequestID`) AS bad_values FROM `vehicleservicerequestassignment` c LEFT JOIN `vehicleservicerequest` p ON c.`VehicleServiceRequestID` = p.`ID` WHERE c.`VehicleServiceRequestID` IS NOT NULL AND c.`VehicleServiceRequestID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestassignment.VehicleServiceRequestStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestassignment` WHERE `VehicleServiceRequestStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestassignment.VehicleServiceRequestStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceRequestStatusID` ORDER BY c.`VehicleServiceRequestStatusID`) AS bad_values FROM `vehicleservicerequestassignment` c LEFT JOIN `vehicleservicerequeststatus` p ON c.`VehicleServiceRequestStatusID` = p.`ID` WHERE c.`VehicleServiceRequestStatusID` IS NOT NULL AND c.`VehicleServiceRequestStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetails.VehicleServiceRequestDetailStatus' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestdetails` WHERE `VehicleServiceRequestDetailStatus` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetails.VehicleServiceRequestDetailStatus' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceRequestDetailStatus` ORDER BY c.`VehicleServiceRequestDetailStatus`) AS bad_values FROM `vehicleservicerequestdetails` c LEFT JOIN `vehicleservicerequeststatus` p ON c.`VehicleServiceRequestDetailStatus` = p.`ID` WHERE c.`VehicleServiceRequestDetailStatus` IS NOT NULL AND c.`VehicleServiceRequestDetailStatus` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetails.VehicleServiceRequestID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestdetails` WHERE `VehicleServiceRequestID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetails.VehicleServiceRequestID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceRequestID` ORDER BY c.`VehicleServiceRequestID`) AS bad_values FROM `vehicleservicerequestdetails` c LEFT JOIN `vehicleservicerequest` p ON c.`VehicleServiceRequestID` = p.`ID` WHERE c.`VehicleServiceRequestID` IS NOT NULL AND c.`VehicleServiceRequestID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetails.VehicleServiceTypeID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestdetails` WHERE `VehicleServiceTypeID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetails.VehicleServiceTypeID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceTypeID` ORDER BY c.`VehicleServiceTypeID`) AS bad_values FROM `vehicleservicerequestdetails` c LEFT JOIN `vehicleservicetype` p ON c.`VehicleServiceTypeID` = p.`ID` WHERE c.`VehicleServiceTypeID` IS NOT NULL AND c.`VehicleServiceTypeID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetailsassigntment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestdetailsassigntment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetailsassigntment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `vehicleservicerequestdetailsassigntment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetailsassigntment.VehicleServiceRequestDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestdetailsassigntment` WHERE `VehicleServiceRequestDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetailsassigntment.VehicleServiceRequestDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceRequestDetailID` ORDER BY c.`VehicleServiceRequestDetailID`) AS bad_values FROM `vehicleservicerequestdetailsassigntment` c LEFT JOIN `vehicleservicerequestdetails` p ON c.`VehicleServiceRequestDetailID` = p.`ID` WHERE c.`VehicleServiceRequestDetailID` IS NOT NULL AND c.`VehicleServiceRequestDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetailsassigntment.VehicleServiceRequestID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestdetailsassigntment` WHERE `VehicleServiceRequestID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetailsassigntment.VehicleServiceRequestID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceRequestID` ORDER BY c.`VehicleServiceRequestID`) AS bad_values FROM `vehicleservicerequestdetailsassigntment` c LEFT JOIN `vehicleservicerequest` p ON c.`VehicleServiceRequestID` = p.`ID` WHERE c.`VehicleServiceRequestID` IS NOT NULL AND c.`VehicleServiceRequestID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetailsassigntment.VehicleServiceRequestStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `vehicleservicerequestdetailsassigntment` WHERE `VehicleServiceRequestStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'vehicleservicerequestdetailsassigntment.VehicleServiceRequestStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VehicleServiceRequestStatusID` ORDER BY c.`VehicleServiceRequestStatusID`) AS bad_values FROM `vehicleservicerequestdetailsassigntment` c LEFT JOIN `vehicleservicerequeststatus` p ON c.`VehicleServiceRequestStatusID` = p.`ID` WHERE c.`VehicleServiceRequestStatusID` IS NOT NULL AND c.`VehicleServiceRequestStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `visitplan` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.CompanyID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `CompanyID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.CompanyID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyID` ORDER BY c.`CompanyID`) AS bad_values FROM `visitplan` c LEFT JOIN `company` p ON c.`CompanyID` = p.`ID` WHERE c.`CompanyID` IS NOT NULL AND c.`CompanyID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.DivisionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `DivisionID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.DivisionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`DivisionID` ORDER BY c.`DivisionID`) AS bad_values FROM `visitplan` c LEFT JOIN `division` p ON c.`DivisionID` = p.`ID` WHERE c.`DivisionID` IS NOT NULL AND c.`DivisionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `visitplan` c LEFT JOIN `companyproject` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.UserIDInput' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `UserIDInput` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.UserIDInput' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDInput` ORDER BY c.`UserIDInput`) AS bad_values FROM `visitplan` c LEFT JOIN `users` p ON c.`UserIDInput` = p.`ID` WHERE c.`UserIDInput` IS NOT NULL AND c.`UserIDInput` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.UserIDSales' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `UserIDSales` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.UserIDSales' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDSales` ORDER BY c.`UserIDSales`) AS bad_values FROM `visitplan` c LEFT JOIN `users` p ON c.`UserIDSales` = p.`ID` WHERE c.`UserIDSales` IS NOT NULL AND c.`UserIDSales` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.UserIDVisitWith' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `UserIDVisitWith` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.UserIDVisitWith' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDVisitWith` ORDER BY c.`UserIDVisitWith`) AS bad_values FROM `visitplan` c LEFT JOIN `users` p ON c.`UserIDVisitWith` = p.`ID` WHERE c.`UserIDVisitWith` IS NOT NULL AND c.`UserIDVisitWith` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.VisitPlanStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `VisitPlanStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.VisitPlanStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanStatusID` ORDER BY c.`VisitPlanStatusID`) AS bad_values FROM `visitplan` c LEFT JOIN `visitplanstatus` p ON c.`VisitPlanStatusID` = p.`ID` WHERE c.`VisitPlanStatusID` IS NOT NULL AND c.`VisitPlanStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.VisitPrincipalCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `VisitPrincipalCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.VisitPrincipalCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPrincipalCPID` ORDER BY c.`VisitPrincipalCPID`) AS bad_values FROM `visitplan` c LEFT JOIN `principalcp` p ON c.`VisitPrincipalCPID` = p.`ID` WHERE c.`VisitPrincipalCPID` IS NOT NULL AND c.`VisitPrincipalCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplan.VisitingPrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplan` WHERE `VisitingPrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplan.VisitingPrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitingPrincipalID` ORDER BY c.`VisitingPrincipalID`) AS bad_values FROM `visitplan` c LEFT JOIN `principal` p ON c.`VisitingPrincipalID` = p.`ID` WHERE c.`VisitingPrincipalID` IS NOT NULL AND c.`VisitingPrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `visitplanassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanassignment.VisitPlanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanassignment` WHERE `VisitPlanID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanassignment.VisitPlanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanID` ORDER BY c.`VisitPlanID`) AS bad_values FROM `visitplanassignment` c LEFT JOIN `visitplan` p ON c.`VisitPlanID` = p.`ID` WHERE c.`VisitPlanID` IS NOT NULL AND c.`VisitPlanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanassignment.VisitPlanStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanassignment` WHERE `VisitPlanStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanassignment.VisitPlanStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanStatusID` ORDER BY c.`VisitPlanStatusID`) AS bad_values FROM `visitplanassignment` c LEFT JOIN `visitplanstatus` p ON c.`VisitPlanStatusID` = p.`ID` WHERE c.`VisitPlanStatusID` IS NOT NULL AND c.`VisitPlanStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplancompanycpdetail.CompanyCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplancompanycpdetail` WHERE `CompanyCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplancompanycpdetail.CompanyCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`CompanyCPID` ORDER BY c.`CompanyCPID`) AS bad_values FROM `visitplancompanycpdetail` c LEFT JOIN `companycp` p ON c.`CompanyCPID` = p.`ID` WHERE c.`CompanyCPID` IS NOT NULL AND c.`CompanyCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplancompanycpdetail.VisitPlanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplancompanycpdetail` WHERE `VisitPlanID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplancompanycpdetail.VisitPlanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanID` ORDER BY c.`VisitPlanID`) AS bad_values FROM `visitplancompanycpdetail` c LEFT JOIN `visitplan` p ON c.`VisitPlanID` = p.`ID` WHERE c.`VisitPlanID` IS NOT NULL AND c.`VisitPlanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetail.ActionID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetail` WHERE `ActionID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetail.ActionID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ActionID` ORDER BY c.`ActionID`) AS bad_values FROM `visitplandetail` c LEFT JOIN `action` p ON c.`ActionID` = p.`ID` WHERE c.`ActionID` IS NOT NULL AND c.`ActionID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetail.BarangID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetail` WHERE `BarangID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetail.BarangID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`BarangID` ORDER BY c.`BarangID`) AS bad_values FROM `visitplandetail` c LEFT JOIN `barang` p ON c.`BarangID` = p.`ID` WHERE c.`BarangID` IS NOT NULL AND c.`BarangID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetail.PrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetail` WHERE `PrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetail.PrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`PrincipalID` ORDER BY c.`PrincipalID`) AS bad_values FROM `visitplandetail` c LEFT JOIN `principal` p ON c.`PrincipalID` = p.`ID` WHERE c.`PrincipalID` IS NOT NULL AND c.`PrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetail.ProjectID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetail` WHERE `ProjectID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetail.ProjectID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ProjectID` ORDER BY c.`ProjectID`) AS bad_values FROM `visitplandetail` c LEFT JOIN `companyprojectdetailcc` p ON c.`ProjectID` = p.`ID` WHERE c.`ProjectID` IS NOT NULL AND c.`ProjectID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetail.VisitActionStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetail` WHERE `VisitActionStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetail.VisitActionStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitActionStatusID` ORDER BY c.`VisitActionStatusID`) AS bad_values FROM `visitplandetail` c LEFT JOIN `visitplanstatus` p ON c.`VisitActionStatusID` = p.`ID` WHERE c.`VisitActionStatusID` IS NOT NULL AND c.`VisitActionStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetail.VisitPlanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetail` WHERE `VisitPlanID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetail.VisitPlanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanID` ORDER BY c.`VisitPlanID`) AS bad_values FROM `visitplandetail` c LEFT JOIN `visitplan` p ON c.`VisitPlanID` = p.`ID` WHERE c.`VisitPlanID` IS NOT NULL AND c.`VisitPlanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.UserID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetailassignment` WHERE `UserID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.UserID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserID` ORDER BY c.`UserID`) AS bad_values FROM `visitplandetailassignment` c LEFT JOIN `users` p ON c.`UserID` = p.`ID` WHERE c.`UserID` IS NOT NULL AND c.`UserID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.VisitActionStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetailassignment` WHERE `VisitActionStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.VisitActionStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitActionStatusID` ORDER BY c.`VisitActionStatusID`) AS bad_values FROM `visitplandetailassignment` c LEFT JOIN `visitplanstatus` p ON c.`VisitActionStatusID` = p.`ID` WHERE c.`VisitActionStatusID` IS NOT NULL AND c.`VisitActionStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.VisitPlanDetailID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetailassignment` WHERE `VisitPlanDetailID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.VisitPlanDetailID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanDetailID` ORDER BY c.`VisitPlanDetailID`) AS bad_values FROM `visitplandetailassignment` c LEFT JOIN `visitplandetail` p ON c.`VisitPlanDetailID` = p.`ID` WHERE c.`VisitPlanDetailID` IS NOT NULL AND c.`VisitPlanDetailID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.VisitPlanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetailassignment` WHERE `VisitPlanID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.VisitPlanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanID` ORDER BY c.`VisitPlanID`) AS bad_values FROM `visitplandetailassignment` c LEFT JOIN `visitplan` p ON c.`VisitPlanID` = p.`ID` WHERE c.`VisitPlanID` IS NOT NULL AND c.`VisitPlanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.VisitPlanStatusID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplandetailassignment` WHERE `VisitPlanStatusID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplandetailassignment.VisitPlanStatusID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanStatusID` ORDER BY c.`VisitPlanStatusID`) AS bad_values FROM `visitplandetailassignment` c LEFT JOIN `visitplanstatus` p ON c.`VisitPlanStatusID` = p.`ID` WHERE c.`VisitPlanStatusID` IS NOT NULL AND c.`VisitPlanStatusID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanfrienddetail.UserIDVisitWith' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanfrienddetail` WHERE `UserIDVisitWith` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanfrienddetail.UserIDVisitWith' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`UserIDVisitWith` ORDER BY c.`UserIDVisitWith`) AS bad_values FROM `visitplanfrienddetail` c LEFT JOIN `users` p ON c.`UserIDVisitWith` = p.`ID` WHERE c.`UserIDVisitWith` IS NOT NULL AND c.`UserIDVisitWith` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanfrienddetail.VisitPlanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanfrienddetail` WHERE `VisitPlanID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanfrienddetail.VisitPlanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanID` ORDER BY c.`VisitPlanID`) AS bad_values FROM `visitplanfrienddetail` c LEFT JOIN `visitplan` p ON c.`VisitPlanID` = p.`ID` WHERE c.`VisitPlanID` IS NOT NULL AND c.`VisitPlanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanlink.VisitPlanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanlink` WHERE `VisitPlanID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanlink.VisitPlanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanID` ORDER BY c.`VisitPlanID`) AS bad_values FROM `visitplanlink` c LEFT JOIN `visitplan` p ON c.`VisitPlanID` = p.`ID` WHERE c.`VisitPlanID` IS NOT NULL AND c.`VisitPlanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanprincipalvisitdetail.VisitPlanID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanprincipalvisitdetail` WHERE `VisitPlanID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanprincipalvisitdetail.VisitPlanID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitPlanID` ORDER BY c.`VisitPlanID`) AS bad_values FROM `visitplanprincipalvisitdetail` c LEFT JOIN `visitplan` p ON c.`VisitPlanID` = p.`ID` WHERE c.`VisitPlanID` IS NOT NULL AND c.`VisitPlanID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanprincipalvisitdetail.VisitingPrincipalCPID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanprincipalvisitdetail` WHERE `VisitingPrincipalCPID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanprincipalvisitdetail.VisitingPrincipalCPID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitingPrincipalCPID` ORDER BY c.`VisitingPrincipalCPID`) AS bad_values FROM `visitplanprincipalvisitdetail` c LEFT JOIN `principalcp` p ON c.`VisitingPrincipalCPID` = p.`ID` WHERE c.`VisitingPrincipalCPID` IS NOT NULL AND c.`VisitingPrincipalCPID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'visitplanprincipalvisitdetail.VisitingPrincipalID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `visitplanprincipalvisitdetail` WHERE `VisitingPrincipalID` = 0 HAVING COUNT(*) > 0;
SELECT 'visitplanprincipalvisitdetail.VisitingPrincipalID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`VisitingPrincipalID` ORDER BY c.`VisitingPrincipalID`) AS bad_values FROM `visitplanprincipalvisitdetail` c LEFT JOIN `principal` p ON c.`VisitingPrincipalID` = p.`ID` WHERE c.`VisitingPrincipalID` IS NOT NULL AND c.`VisitingPrincipalID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;
SELECT 'warehouse.ParentID' AS col, 'zero_sentinel' AS issue, COUNT(*) AS n FROM `warehouse` WHERE `ParentID` = 0 HAVING COUNT(*) > 0;
SELECT 'warehouse.ParentID' AS col, 'orphan' AS issue, COUNT(*) AS n, GROUP_CONCAT(DISTINCT c.`ParentID` ORDER BY c.`ParentID`) AS bad_values FROM `warehouse` c LEFT JOIN `warehouse` p ON c.`ParentID` = p.`ID` WHERE c.`ParentID` IS NOT NULL AND c.`ParentID` <> 0 AND p.`ID` IS NULL HAVING COUNT(*) > 0;

-- ---------------------------------------------------------------------
-- PART B - the 4 columns section 3c USED to drop.
--
-- NOTHING IS DROPPED ANY MORE. Section 3c was removed on 2026-08-13: dropping a populated column
-- from production is unrecoverable, and criterion 3 requires changes to bukanmain to be additive.
-- These columns now STAY here, and 63 gains them instead, via migration
-- 2026_08_13_100300_add_legacy_only_columns_to_match_production.
--
-- The census is kept because it is the evidence for that decision -- it shows what would have
-- been destroyed. Nothing here is a reason not to proceed.
-- ---------------------------------------------------------------------
SELECT 'comissionpercentage.DateInput' AS col, 'KEPT (was: dropped)' AS status, COUNT(*) AS rows_total, SUM(`DateInput` IS NOT NULL) AS rows_with_a_value FROM `comissionpercentage`;
SELECT 'comissionpercentage.Keterangan' AS col, 'KEPT (was: dropped)' AS status, COUNT(*) AS rows_total, SUM(`Keterangan` IS NOT NULL AND `Keterangan` <> '') AS rows_with_a_value FROM `comissionpercentage`;
SELECT 'labworkrequestdetails.ProjectIDDetails' AS col, 'KEPT (was: dropped)' AS status, COUNT(*) AS rows_total, SUM(`ProjectIDDetails` IS NOT NULL AND `ProjectIDDetails` <> 0) AS rows_with_a_value FROM `labworkrequestdetails`;
SELECT 'samplerequestimportfrom.DefaultCreateStatus' AS col, 'KEPT (was: dropped)' AS status, COUNT(*) AS rows_total, SUM(`DefaultCreateStatus` IS NOT NULL AND `DefaultCreateStatus` <> 0) AS rows_with_a_value FROM `samplerequestimportfrom`;

-- ---------------------------------------------------------------------
-- PART C - do any of the 12 new tables already exist?  MUST RETURN NOTHING
--
-- Section 2 creates FOUR tables and section 2b creates EIGHT more, out of the 67 that 63 has
-- and bukanmain lacks. The other 55 are not introduced to production at all (user decision
-- 2026-08-13: only tables with a proven application code path). If any of these twelve is
-- already here, STOP -- the CREATE will fail and something you did not expect made it.
--
-- The eight in section 2b are the Laravel runtime tables. Their presence would mean this
-- database has already had `php artisan migrate` run against it -- which is precisely the
-- mistake that produced the wrong `bukanmain.sql` dump and left production without them.
-- PART 0b check 1 asserts the same thing and prints a verdict; this is the detail view.
-- ---------------------------------------------------------------------
SELECT TABLE_NAME, TABLE_ROWS, ENGINE FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME IN (
  -- section 2
  'budgetandtargetachievements', 'budgetandtargetreal', 'nsproduct', 'quotationitemorigin',
  -- section 2b (added 2026-08-14)
  'cache', 'cache_locks', 'failed_jobs', 'job_batches', 'jobs', 'migrations',
  'notification', 'sessions'
);

-- ---------------------------------------------------------------------
-- PART D - the three decimal conversions that were REMOVED, and the census that removed them
--
-- ⚠️ REWRITTEN 2026-08-14, AFTER A REAL PRODUCTION ABORT. This part used to describe three
--    conversions the migration performed. IT NO LONGER PERFORMS THEM. What happened:
--
--      ERROR 1264 (22003) at line 672: Out of range value for column 'UnitPriceIDR' at row 11061
--
--    Section 3d converted `quotation`.`USDRate`, `quotationdetails`.`USDRate` and
--    `quotationdetails`.`UnitPriceIDR` from decimal(20,2) to decimal(20,10), and called all of
--    its conversions "lossless". For these three that was FALSE: total precision stays 20 while
--    the scale goes 2 -> 10, so the INTEGER side narrows from 18 digits to 10 -- a ceiling of
--    10^10. Production holds values above it. The first of the three succeeded, the second
--    statement aborted, and the run stopped inside section 3d with nothing destructive yet done.
--
--    STRICT_TRANS_TABLES is the ONLY reason it aborted instead of silently clamping the value to
--    9999999999.9999999999. That is precisely what PART 0 explains the migration forces it on for.
--
--    RESOLUTION: production KEEPS decimal(20,2). Section 3d no longer touches these three columns,
--    and 63 comes to meet production instead, by migration
--    2026_08_14_100100_narrow_quotation_decimals_to_match_legacy.
--
-- D1. THE CENSUS THAT PROVES IT. Rows that decimal(20,10) could not represent. Non-zero here is
--     EXPECTED and is the evidence -- it is no longer a blocker, because nothing converts these
--     columns any more. If it returns NOTHING, your data would have fitted after all; the
--     conversions are still correctly removed, because production's type is the source of truth.
SELECT 'quotation.USDRate' AS col, 'would NOT fit decimal(20,10) - conversion removed' AS status, COUNT(*) AS n, MAX(ABS(`USDRate`)) AS largest FROM `quotation` WHERE ABS(`USDRate`) >= 10000000000 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.USDRate' AS col, 'would NOT fit decimal(20,10) - conversion removed' AS status, COUNT(*) AS n, MAX(ABS(`USDRate`)) AS largest FROM `quotationdetails` WHERE ABS(`USDRate`) >= 10000000000 HAVING COUNT(*) > 0;
SELECT 'quotationdetails.UnitPriceIDR' AS col, 'would NOT fit decimal(20,10) - conversion removed' AS status, COUNT(*) AS n, MAX(ABS(`UnitPriceIDR`)) AS largest FROM `quotationdetails` WHERE ABS(`UnitPriceIDR`) >= 10000000000 HAVING COUNT(*) > 0;

-- D2. THE PRECONDITION FOR THE 63-SIDE MIGRATION.  MUST RETURN NOTHING.
--     2026_08_14_100100 narrows those columns to decimal(20,2) on the DEVELOPMENT database.
--     Narrowing a scale ROUNDS, silently. Any row here carries more than 2 decimal places and
--     would lose them. Measured on 63 before the migration was written: zero rows in all three.
--     Run this against 63, not against production -- production is already decimal(20,2), so it
--     is structurally incapable of returning a row and will always print nothing.
SELECT 'quotation.USDRate' AS col, 'has >2 decimal places' AS status, COUNT(*) AS n FROM `quotation` WHERE `USDRate` <> ROUND(`USDRate`, 2) HAVING COUNT(*) > 0;
SELECT 'quotationdetails.USDRate' AS col, 'has >2 decimal places' AS status, COUNT(*) AS n FROM `quotationdetails` WHERE `USDRate` <> ROUND(`USDRate`, 2) HAVING COUNT(*) > 0;
SELECT 'quotationdetails.UnitPriceIDR' AS col, 'has >2 decimal places' AS status, COUNT(*) AS n FROM `quotationdetails` WHERE `UnitPriceIDR` <> ROUND(`UnitPriceIDR`, 2) HAVING COUNT(*) > 0;

-- D3. NO OTHER NUMERIC CONVERSION IN SECTION 3d CAN OVERFLOW. Checked, not assumed:
--     complaindetails.QuantityPacking / .ComplainQuantity and
--     samplerequestimportgoodsreceipt.QuantityReceived all go int -> decimal(20,5). `int` tops
--     out at 10 digits; decimal(20,5) allows 15 before the point. Strictly wider, cannot abort.

-- ---------------------------------------------------------------------
-- PART E - RETIRED on 2026-08-13.
--
-- It counted NULLs in `complainitemdetailslotassignment`.`DepName`, which section 4b tightened to
-- NOT NULL, and it said those NULLs would be "converted to '' / 0 with a warning, not an error".
-- THAT WAS WRONG. Under STRICT_TRANS_TABLES -- which the migration keeps on deliberately, and
-- which MariaDB 10.4 sets by default -- `MODIFY ... NOT NULL` over a column holding NULLs is
-- ERROR 1138 and the script ABORTS. An operator who read PART E, saw a non-zero count and
-- proceeded would have been told the opposite of what was about to happen.
--
-- Section 4b was removed. 63 relaxes the column to nullable instead, by migration
-- 2026_08_13_100500_relax_depname_to_match_legacy. The count is kept below for information only;
-- it no longer gates anything.
-- ---------------------------------------------------------------------
SELECT 'complainitemdetailslotassignment.DepName' AS col, 'informational only - no longer tightened' AS status, COUNT(*) AS nulls FROM `complainitemdetailslotassignment` WHERE `DepName` IS NULL HAVING COUNT(*) > 0;

-- ---------------------------------------------------------------------
-- PART F - the one-off data REPAIR in section 4c.  READ THIS ALONGSIDE PART A.
--
-- PART A reports `quotationdetails.QuotationPackID` as having orphans. Do NOT read that line as
-- "these will be nulled" -- they will be REPAIRED instead, by section 4c, and nothing is lost.
--
-- Those values are `packing` ids that a legacy screen wrote into the `quotationpack` column.
-- Section 4c moves each one to `PackingID` and leaves 0 behind. The proof is the third column
-- below: `QuantityPacking` matches the leading number of the packing name it points at.
--
-- rows_to_repair here should equal the orphan count PART A reports for that column. If it does
-- NOT, some orphans are values that resolve in neither table -- those genuinely will be nulled,
-- and the difference is how many.
-- ---------------------------------------------------------------------
SELECT 'quotationdetails.QuotationPackID' AS col,
       COUNT(*) AS rows_to_repair,
       COUNT(DISTINCT d.`QuotationPackID`) AS distinct_packing_ids,
       SUM(d.`QuantityPacking` = CAST(REGEXP_SUBSTR(p.`PackingName`, '^[0-9.]+') AS DECIMAL(20,5))) AS quantity_matches_pack_name
FROM `quotationdetails` d
  JOIN `packing` p ON p.`ID` = d.`QuotationPackID`
  LEFT JOIN `quotationpack` qp ON qp.`ID` = d.`QuotationPackID`
WHERE d.`QuotationPackID` IS NOT NULL AND d.`QuotationPackID` <> 0
  AND qp.`ID` IS NULL AND (d.`PackingID` = 0 OR d.`PackingID` IS NULL);

-- Orphans on that column that section 4c can NOT repair -- these WILL be nulled by section 6.
SELECT 'quotationdetails.QuotationPackID' AS col, 'unrepairable - will be nulled' AS status,
       COUNT(*) AS n, GROUP_CONCAT(DISTINCT d.`QuotationPackID` ORDER BY d.`QuotationPackID`) AS bad_values
FROM `quotationdetails` d
  LEFT JOIN `quotationpack` qp ON qp.`ID` = d.`QuotationPackID`
  LEFT JOIN `packing` p ON p.`ID` = d.`QuotationPackID`
WHERE d.`QuotationPackID` IS NOT NULL AND d.`QuotationPackID` <> 0
  AND qp.`ID` IS NULL
  AND (p.`ID` IS NULL OR (d.`PackingID` <> 0 AND d.`PackingID` IS NOT NULL))
HAVING COUNT(*) > 0;
