| | |
| | | t.filmsId, |
| | | t.thickness, |
| | | case |
| | | when type in (7, 8) and status = 1 then '' |
| | | when type in (8, 9) and status = 1 then '' |
| | | else t1.working_procedure end as working_procedure, |
| | | ROW_NUMBER() OVER (PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn |
| | | FROM detail_temp t |
| | |
| | | t.width, |
| | | t.height, |
| | | COUNT(DISTINCT t.glass_id) as lack_count, |
| | | COUNT(DISTINCT CASE WHEN t1.type IN (7,8) AND t1.status = 1 THEN t.glass_id END) as damage_count |
| | | COUNT(DISTINCT CASE WHEN t1.type IN (8,9) AND t1.status = 1 THEN t.glass_id END) as damage_count |
| | | FROM detail_temp t |
| | | LEFT JOIN damage_latest t1 ON t.glass_id = t1.glass_id |
| | | GROUP BY |
| | |
| | | t.filmsId, |
| | | t.thickness, |
| | | case |
| | | when type in (7, 8) and status = 1 then '' |
| | | when type in (8, 9) and status = 1 then '' |
| | | else t1.working_procedure end as working_procedure, |
| | | ROW_NUMBER() OVER (PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn |
| | | FROM detail_temp t |