Inspections
Alle Inspektionen mit NDT-Methode, Datum, Operator, Scope und zugehörigem Object/Client/Material/Dimension.
SQL anzeigen
SELECT
i.inspection_id,
i.file_id,
o.client_name,
o.client_no,
o.plant,
o.system_name,
o.object_name,
o.bundle_name,
o.serial_no,
o.construction_year,
m.description AS material,
m.magnetic AS material_magnetic,
d.od AS dim_od,
d.wt AS dim_wt,
d.length AS dim_length,
ts.tube_count,
i.inspection_no,
i.ndt_id AS ndt_method,
i.ndt_name,
i.report_no,
i.date_from,
i.date_to,
i.created AS inspection_created,
i.position,
i.remark,
i.specification,
i.operator,
i.scope_tubes,
i.scope_length,
i.type_of_results,
i.z_unit,
(SELECT COUNT(*) FROM results r WHERE r.inspection_id = i.inspection_id) AS results_total,
(SELECT COUNT(*) FROM results r WHERE r.inspection_id = i.inspection_id AND r.state='rsVisible') AS results_visible,
(SELECT MAX(r.class_num) FROM results r WHERE r.inspection_id = i.inspection_id AND r.state='rsVisible') AS max_defect_class,
f.rel_path AS file_path
FROM inspections i
JOIN files f ON f.file_id = i.file_id
LEFT JOIN objects o ON o.file_id = i.file_id
LEFT JOIN materials m ON m.file_id = i.file_id AND m.idx = 0
LEFT JOIN dimensions d ON d.file_id = i.file_id AND d.idx = 0
LEFT JOIN tube_systems ts ON ts.file_id = i.file_id
WHERE f.parse_error IS NULL