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

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -