Igor Ruan 0 Posted July 17, 2014 Report Share Posted July 17, 2014 Bom Dia! Estou estudando há um tempinho SQL e em um exercício eu fiquei empacado em um. Como selecionar o maior nome de um Cliente? A minha tentativa frustrada ficou da seguinte maneira: SELECT CustomerName FROM [Customers] WHERE CustomerName=(SELECT MAX(LEN(CustomerName)) FROM [Customers]) Alguma sugestão? Obrigado Quote Link to post Share on other sites
0 Marcelo_2 0 Posted July 19, 2014 Report Share Posted July 19, 2014 tente assim: SELECT top 1 CustomerName, max(LEN(CustomerName)) 'letras' FROM Customers group by CustomerName order by 'letras' desc Quote Link to post Share on other sites
0 leoferrareto 0 Posted November 17, 2014 Report Share Posted November 17, 2014 SELECT NOME_FUNCIONARIO, LEN(NOME_FUNCIONARIO) AS Qtde, DENSE_RANK() OVER (ORDER BY LEN(NOME_FUNCIONARIO) Desc) posição FROM dbo.FUNCIONARIO Quote Link to post Share on other sites
Question
Igor Ruan 0
Bom Dia!
Estou estudando há um tempinho SQL e em um exercício eu fiquei empacado em um.
Como selecionar o maior nome de um Cliente?
A minha tentativa frustrada ficou da seguinte maneira:
Link to post
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.