I have need of some logic in a stored procedure. All the stored procedure does it perform a couple of logic rules and then returns a true or false depending on the result.
The pseudo SQL code:
CREATE TABLE #PV ([Date] DATETIME, Dis FLOAT, Del Float, Sold Float)
INSERT #PV exec GetPVSummaryReport @ID, @PID, @From, @To
SELECT AVG(Dis) / 8 AS DisAvg, AVG(Del) AS DelAvg FROM #PV
IF DisAvg > 20 -- this is the bit I am having problems grokking
RETURN TRUE
ELSE
-- do longer calculation
How do you do this sort of logic?
Notes about the code: The table #PV has 4 fields - those provided (Date, Dis, Del and Sold).