sql server complex query, then email IF
Posted on 2014-01-21
I am trying to run a sql query something like this:
I need to run this first statement in a loop, pulling the where divisionInt = should be all the id's in table 'bkgDivision'
then I need to know how many rows were returned. If more than 1 row is returned, I will execute a sendmail.
How would I write it up?
select * from bkgReciepts where divisionInt = bkgDivision.id ...
if more than 1 row then
' i know what to put here