I am a little stuck and need some ideas please. Example below.
Database table 1 has a single column with a comma separated list of IDs all relative to the first table
tbl1.id | tbl1.vehicles_to_show |
---|---|
1 | 3,1,2,4 |
Database table 2 has hundreds of rows of data
tbl2.id | tbl2.vehicle |
---|---|
1 | Cars |
2 | Boats |
3 | Trucks |
4 | Planes |
I have a database query on my page which lists all the records from table 2 if they are inside the array of IDs inside table 1
This is working perfectly, however if my table 1 array is “3,1,2,4” then I would like them to display in that order, right now it is displaying in “1,2,3,4”
My Wappler query is pretty simple
- Database Connection
- Single Database Query (tbl1.vehicles_to_show column - no sorting, no conditions)
- Multi Database Query (tbl2 all columns - no sorting, condition tbl2.id IN tbl2.vehicles_to_show.split(",")
It does make perfect sense to me why they are in the oder of table 2s rows, but i really need it to follow the order of the numbers in the array, is this somehow achievable.
Community Page
Last updated:
Last updated: