I’m trying to query something that is sorted by a where clause then I wanted to order the data by a specific value (I’m implementing a sort dropdown on a table). This isn’t working though and I can’t figure out why.
SELECT * FROM reservation_form_results WHERE campaign_id = $campaignId ORDER BY FIELD(status, '$sortValue')
It works without the WHERE clause, but I need that in order to sort the data first.