Can somebody help me with a query. I want to get all the IDs which has 'somecode' and 'M' code. Here IDs 101 and 103 would get selected.
declare @temp table (ID int, code int)
insert into @temp (ID,code)
select 101,'A25' union
select 101,'M' union
select 102,'M' union
select 102 ,'M' union
select 103,'B39' union
select 103,'M' union
select 104,'M' union
select 104,'R99'
Thanks.
NSG12