stored procedures - Using MIN(left(@prefix, 3)) in SQL -
i'm trying use min(left) in sql find prefix of id (for example want ujh ujh5433)
@prefix varchar(25) select [description] prefix prefix = min(left(@prefix, 3))
when try execute
alter procedure [dbo].[prefixinfo2]
statement, sql doesn't seem min(left(@prefix, 3))
format. error message get:
an aggregate may not appear in clause unless in subquery contained in having clause or select list, , column being aggregated outer reference.
is there way min work?
all need prefix of id left(@id, 3)
. don't need min
.
Comments
Post a Comment