[TYPO3-dev] Order result of query based on comma-seperated string
Sacha Vorbeck
Vorbeck at moduleBox.com
Thu Oct 2 08:20:43 CEST 2008
Hello Oliver,
> The 5th parameter of SELECT_query() can be set to the sort column of the
> table. But I guess you'd like to have a very specific sorting as
> provided in the string $bookIDs ("3,1,4,2")?
exactly.
Therefore you can use the
> "ORDER BY FIELD()" in MySQL - however this query is not very efficient
> compared to database normalization...
> 'FIELD(uid, ' . $bookIDs . ')',
thank you very much. Efficiency is not that important here as there are
only a few records. But of course it would be better to otimize things
right from the start. So what would be the best/most efficient way to
code this? Do the sorting in PHP?
--
all the best,
Sacha
More information about the TYPO3-dev
mailing list