Project

General

Profile

Actions

Feature #79054

closed

Custom Order By Clause

Added by Harald Holzmann almost 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2016-12-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Hello,

in a Repository I will sort the result by a custom clause. For example I will search the nearest value. For this I calculate the deviation betwenn the values and rank them by this. So the first one will be the result with the nearest value.

For this i have to use prepared statements:
SOME SQL +order by ABS limit 1;

Would be nice if in the repository i could use something like:
$query->setOrderings(
array(
'ABS' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
)
);


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Feature #32051: Concat ordering for Database requestNew2011-11-24

Actions
Actions #1

Updated by Morton Jonuschat almost 8 years ago

  • Status changed from New to Needs Feedback

Can you try if it works if you conform to the Extbase way of having fieldnames lowercased/underscored? Instead of `ABS` use `abs`.

Actions #2

Updated by Harald Holzmann almost 8 years ago

I have tried it: no changes. The typo3 error messages: "#1247602160: FUNCTION xxx.abs does not exist". He is looking for a column named xxx.abs, which obviously does not exist.

Actions #3

Updated by Alexander Opitz over 7 years ago

  • Category set to Extbase
  • Status changed from Needs Feedback to New
Actions #4

Updated by Dominik Steinborn over 7 years ago

The same error occurs when trying to order by the statement "IF": FUNCTION TABLENAME.i_f does not exist


$query->setOrderings(
array(
'IF(FIELD1='VALUE', FIELD2, FIELD3)' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
)
);

Actions #5

Updated by Dominik Steinborn over 7 years ago

  • Priority changed from Should have to Must have
Actions #6

Updated by Benni Mack over 4 years ago

  • Related to Feature #32051: Concat ordering for Database request added
Actions #7

Updated by Benni Mack over 4 years ago

  • Status changed from New to Closed

Hey,

see issue #32051 which is already under review - I will close this one as a duplicate.

Actions

Also available in: Atom PDF