Files
appsmith-statistics-app/pages/Operations - Engineering Holds/queries/engineering_holds/engineering_holds.txt

19 lines
648 B
Plaintext

SELECT COALESCE(wo.wo_number || '-' || wo.wo_subnumber, '-') AS wo,
item_descrip1 AS descrip,
comment_user AS user,
comment_text AS comment,
comment_date AS date
FROM wo
JOIN comment ON wo_id = comment_source_id AND comment_source = 'W' AND comment_cmnttype_id = 23
JOIN itemsite ON wo_itemsite_id = itemsite_id
JOIN item on item_id = itemsite_item_id
WHERE wo_status = 'I'
AND NOT EXISTS (
SELECT 1
FROM comment c2
WHERE c2.comment_source_id = wo.wo_id
AND c2.comment_source = 'W'
AND c2.comment_cmnttype_id = 23
AND c2.comment_text LIKE '%Done%'
)
ORDER BY comment_date