title: Return data only for specific condition SQL Server
body: <p>I need help on my query to display data only for an specific condition.</p>
  <p>Here is the query</p>
  <pre><code>select      sv.lookupCode as shipment,
              tv.materialLookupCode,
              tv.vendorLotLookupCode,
              sv.shippedDate
  
  from        datex_footprint.ShipmentsView sv
  join        datex_footprint.TasksView tv on sv.id = tv.shipmentId
  
  where       sv.typeId = 2
  and         sv.statusId = 8
  and         sv.shippedDate Between Dateadd(mm,-30,getdate()) ANd getdate()
  and         sv.lookupCode = '58321'
  and         tv.operationCodeId = 8
  and         tv.projectId = 490
  
  
  group by    sv.lookupCode,
              tv.materialLookupCode,
              tv.vendorLotLookupCode,
              sv.shippedDate
  </code></pre>
  <p>So in my query I need to add where it should only return those 4 highlighted rows which are 4, so basically it should only return duplicate materialLookupcodes having more than 1 vendorlotlookupcode</p>
  <p><a href="https://i.stack.imgur.com/G2ikV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G2ikV.png" alt="enter image description here" /></a></p>