I don't know if this question has been asked previously also. If so please direct me to the link.
I have a table that has three columns name, type and date. Type can only be 4 values A, B, C and D
I want to fetch all those records which are of type A, B or C but the condition is that it should only fetch if the same name also has a type of D.
e.g. lets consider this table
Name type Date
abc A 5/7
abc B 6/7
abc D 7/7
xyz A 5/7
xyz D 6/7
lmn A 5/7
lmn B 6/7
lmn C 7/7
So the deal here I need the following result set
ABC 5/7
ABC 6/7
XYZ 5/7
Because ABC and XYZ has a type D the other records of ABC and XYZ are shown. Since lmn does not have a type D it's not included in the result set.