I have one table
petVac(pet, vaccine)
the data looks like this:
pet vaccine P1 | V1 P2 | V2 P3 | V3 P1 | V3 P2 | V4
I want to know if a query could be created that would list the pet and vaccine that a pet has not taken yet.
For example, it would result in something like:
pet |vaccineNotTaken P1 V2 P1 V4 P2 V1 P2 V3 P3 V1 P3 V2 P3 V4
etc...
I tried doing select pet, vaccine from petVac where not exists (select distinct pet, vaccine from petVac);
but it results in an empty set. I am confused on how to go about this, is it possible?
没有评论:
发表评论