Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Query needed

$
0
0

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


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>