I tried the below but still am picking up all the order that are active instead of the active orders that are missing equipmentid "1111".
Oh, I understand now. Just having order_details.equipmentid<>1111 does not work as an order may also have some other equipmentid in a related order detail row.
One possible solution is to use a subquery, e.g.,
SELECT DISTINCT orderid
FROM orders
WHERE status = 'ACTIVE'
AND orderid NOT IN
(SELECT DISTINCT orders.orderid
FROM orders, order_details
WHERE orders.orderid = order_details.orderid
AND orders.status = 'ACTIVE'
AND order_details.equipmentid = 1111)
.By the way, note that single quotes are used to delimit strings. Double quotes are used to delimit identifiers, though for some database management systems they are allowed to delimit strings as well.