SELECT
basic_workstation."id",
basic_workstation.workstation_no,
basic_workstation.name,
basic_workstation.type,
basic_workstation.remark
FROM
basic_workstation
WHERE active = true
and basic_workstation."id"
NOT IN (
SELECT
basic_workstation."id"
FROM
basic_workstation,
aps_resource
WHERE
aps_resource.workstation_id = basic_workstation."id"
and aps_resource.active = TRUE
)