Hi,
i need help to query below all 4 tables and finally grouped by ITEM_INSPECTED. so basically trying to get one row instead of three row from condition table. so far i was able to query only condition table using below script but i want to merge all tables and result will be like below.
PROJECT_NUMBER | PHYSICAL_INSPECT_DATE | PHY_COND | CATEGORY | DEFICIENCY_CODE | LIFE_SAFETY | ON_PRIOR_REP | REPAIR_TIME |
600002 | 6/8/2018 | EXTERIOR | Flashing | C | * | Y | 8 |
select project_num,physical_inspect_date,min(deficiency_code), max(life_safety),max(on_prior_rep),max(repair_time)
from CONDITION
where project_num='600002' and physical_inspect_date='8-JUNE-2018'
group by project_num,physical_inspect_date
CONDITION:
PROJECT_NUMBER | PHYSICAL_INSPECT_DATE | CATEGORY | DEFICIENCY_CODE | LIFE_SAFETY | ON_PRIOR_REP | REPAIR_TIME | DEFICIENCY_ID |
600002 | 6/8/2018 | Flashing | C | * | N | 8 | 24 |
600002 | 6/8/2018 | Drains | M | * | Y | 4 | 27 |
600002 | 6/8/2018 | Vents | C | N | 6 | 30 |
COND_DEFICIENCY:
DEFICIENCY_ID | CATEGORY_ID | DEFICIENCY |
24 | 5 | Repair damaged aluminum counter flashing |
27 | 6 | Replace missing drain caps |
30 | 7 | Repair the damaged vent cover located |
COND_CATEGORY:
CATEGORY_ID | CATEGORY | ITEM_INSPECTED |
5 | Flashing | 2 |
6 | Drains | 2 |
7 | Vents | 2 |
ITEMS_CATEGORY:
ITEM_INSPECTED | ITEM_DESCRIPTION | ITEM_CATEGORY |
2 | Roofs, flashing, vents | Exterior Items Inspected |