-1

I have a MySQL table named camp_details which has the following columns :

camp_id, camp_name, location, category, months , pattern 

I have input fields which accepts values for location, category, months and pattern.

Based on the details provided, the table should sort according to the preferences (1:location , 2:Months , 3:pattern and 4:category).

That is, the table should display first containing location, next months and so on.

Kindly help me out in this.

antorqs
  • 619
  • 3
  • 18

1 Answers1

0

just use this query

SELECT * FROM camp_details ORDER BY location , months,patter,category ;

or use DESC after column name which you want to sort in desc like

SELECT * FROM camp_details ORDER BY location , months DESC,patter,category ;
Passionate Coder
  • 7,154
  • 2
  • 19
  • 44