> >CREATE TABLE dbo.MaxTest (Name varchar(50), PayRate decimal(14,4)) > >insert into dbo.MaxTest values ('Kevin', 50), > ('Katy', 60) >>
>DECLARE @MaxRate decimal(14,4) >SET @MaxRate = (SELECT MAX(PayRate) from dbo.MaxTest GROUP BY Name) >SELECT @MaxRate >>
>DECLARE @MaxRate decimal(14,4) >SELECT @MaxRate = MAX(PayRate) FROM dbo.MaxTest GROUP BY Name >SELECT @MaxRate >The first sample will generate an error about subquery produced more than 1 row. The second sample will not generate an error but I can not say which result it will return since in both cases you have GROUP BY Name at the end. In the second case the result can be either of 2 values.