0

How to sort a table base on the tags?

I have one list in the table. It consists student ID, name, faculty and year of study. I can display all the data from database using php. Now I want to sort the data base on those categories: student ID, name, faculty and year of study. Any idea?

1st Sep 2018, 2:39 AM
raix832
raix832 - avatar
1 Answer
0
Use ORDER BY to sort the results, multiple sort fields are supported, each separated by comma. Syntax: SELECT <fields_list> FROM <table_name> ORDER BY <sort_fields_list> [ASC | DESC] Example: SELECT * FROM students ORDER BY student_id, student_name, faculty, year_of_study; ASC (default) is used for sorting in ascending order, DESC is for descending order. Hth, cmiiw
1st Sep 2018, 3:51 PM
Ipang