Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

Need to trigger a condition if a column occurs more than once

$
0
0

I need to write a query that will calculate the sum of one column only if another column is returned more than one time. 

For example. if product number 11111 is sent to location "home" (column that does the triggering) more than one time, I need to return the sum of the quantity shipped column.  I don't know if I am phrasing this right, so if this is confusing I will be happy to try and elaborate.  If I were writing this in a more familiar language I would try something like:

If (columnlLocation > 1)

{

     Then total += columnLocation.quanitityShipped

     return total;

}


Viewing all articles
Browse latest Browse all 4729

Trending Articles



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