sql - where clauses in max statement -
how possible add together query , converting or replacing or max value!
max(convert(int,replace(( queuenum ),'-',''))) [queue]
i want homecoming max of records have special , in clauses queuenum .
edited :
data :
1981-1-1232 1981-1-1235 1981-1-1234 1981-2-1 1981-2-2 1981-2-13
how possible homecoming max value of record started 1981-2
i guess mssql database in case seek utilize next statement without conversion:
sqlfiddle demo
select top 1 queuenum queue queuenum '1981-2-%' order len(queuenum) desc, queuenum desc
sql
No comments:
Post a Comment