Closed tobz-nz closed 9 years ago
I think you'd have to do this:
$entries = Entries::channel('products')
->join(
'files',
DB::raw("CONCAT('{filedir_', exp_files.upload_location_id, '}', exp_files.file_name)"),
'=',
'field_id_12'
)
->orderBy('files.file_size', 'desc') // or files.mime_type or files.upload_date
->get();
Yeah this worked after a fashion. Had a related issue with deuplicate files in in files table which threw me for a while. Doing a sync in EE sorted that out.
Thanks for the suggestion.
I have a channel with a file field, I'd like to sort the entries by the [size/type/date] of a file in that field. Not sure if that's possible of not?
I know it's possible to sort the collection after the fact, the problem is that it's a paginated query; so that wouldn't work.
Any ideas?