News

SELECT company, AVG(net_amount), FROM Sales WHERE net_amount > 100 GROUP BY company; The above example will apply the AVG function only to rows that qualified under the WHERE restriction.
I'm doing this in a stored proc using SQL Server.<BR><BR>Basically, I'm executing 1 SELECT statement and if that returns any rows then I want to do a SELECT INTO #Temp With criteria A.