I would like to write an SQL query (oracle) to know whether the operation (identified by ope.ope_operationid) has at least an operation of a certain type (opt.opt_id), and if not, show that it is not in the results.
For example, I have this operation LAA351BP (I know that it exists in the database), and I would like to know if it even has a type of operation whose id is 3781. If it is, print everything if it is not, print the operationid file and something like "not found" next to it
Is the nvl function used? I can't seem to get it to work correctly.
SELECT DISTINCT ope.ope_operationid,
ser.ser_code,
opt.opt_code,
ost.ost_code
FROM od_operation ope,
od_service_type ser,
od_operation_type opt,
od_status_type ost,
od_equipment_type eqt,
WHERE ope.ser_id = ser.ser_id
AND opt.opt_id = ope.opt_id
AND ost.ost_id = ope.ost_id
AND ope.opt_id = 3781
AND ope.ope_operationid = 'LAA351BP'
thank
source
share