If i have a table with a column values alpha, azera, beta, brown, charlie, cling
How do i get the values like azera, brown and cling since “al” in alpha comes first “az” in azera.. I started using this in SQL 2005.
Select top 1 columnA from TableA order by ColumnA desc
It gives me only 1 result but i need to get for each alphabet A B and C.
Thank you in advance
Your question is a little unclear but I’m assuming you want the largest (when alphabetically sorted) value for each starting letter. That is, if it were a dictionary you want the last entry for
a, the last entry forb, and so on. If so, try:SQL Fiddle