Wednesday, May 6, 2015

Query Optimization

Something doesn't seem quite right with your query.  I understand the inner query - it calculates a sum grouped by a set of criteria - midnight, callhour etc.  Then you are trying to assign that to SETPAY.  This should generate a runtime error about subquery returning more than one value.  How many rows does the inner query generate?

I haven't tested it, so I might be misreading your query. How many rows does the inner query return?  Also, what is the purpose of the ##tempa in the outer query?

No comments:

Post a Comment