How to select a last value from a single column | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to select a last value from a single column

mysql query

14th Mar 2018, 5:50 AM
Atul Singh
Atul Singh - avatar
3 Answers
+ 4
You can achieve that by selecting from that column in a descending order and limiting the query results to one Example: SELECT name FROM students_table ORDER BY name DESC LIMIT 1 Hope it helps
14th Mar 2018, 7:10 AM
Derrick Witness Abucheri
Derrick Witness Abucheri - avatar
0
but that would give me a row like name 56
14th Mar 2018, 6:19 PM
Atul Singh
Atul Singh - avatar
0
anyway i got it , every query in sql give us a row which is an array form from which we can access values using index like array[1] etc. Thank you for your help though
14th Mar 2018, 6:20 PM
Atul Singh
Atul Singh - avatar