سؤال

My title probably isn't the best, but essentially I have a table that stores a host, vulnerability finding reference, and status. I am trying to query on those, but where I don't have an entry I want to force it to show me a defaulted value for the status. Here's an example...

SELECT f.host_id, f.`status` FROM findings f WHERE f.finding_id = 1 AND f.host_id IN (1,2,3)

So if there is an entry for 1 & 2, but not 3, I will want an entry for 3, but with a defaulted status value of 'No Data'.

TIA

EDIT:
I am trying to avoid doing 3 queries because I may have dozens of hosts in that list and that would be a major performance hit!

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى dba.stackexchange
scroll top