how do we sort by using the last three letters of names of people in the people column in a table? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how do we sort by using the last three letters of names of people in the people column in a table?

15th Jul 2016, 12:46 AM
Harsha Vardhan
Harsha Vardhan - avatar
5 Answers
+ 2
select * from table order by right(people,3)
15th Jul 2016, 8:55 AM
Darren Williams
Darren Williams - avatar
+ 1
you could declare it like variable
15th Jul 2016, 7:38 AM
jagb
0
right(people, 3) showing error near "(". I m using customer table here and tried query - order by right(firstname, 3)
17th Jul 2016, 4:43 AM
Rosekamal
0
hmm.. try this: select * from table as a order by right (a.people,3)
17th Jul 2016, 5:59 AM
jagb
0
Showing the same error. the Right option seems unidentified I guess. Btw, what is the significance of using "a." here?
17th Jul 2016, 7:05 AM
Rosekamal