HI
I wrote below SP
ALTER procedure [dbo].[viewSpecialReg]
as
begin
select (select Name from S_register) as Name,(select Behcode from Behcode where date=MAX(date)) as behcode
end
but this error happen
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.