Extbase query to compare two fields in one table

Is it possible to compare two database fields in api request? For example, I want to compare the tstamp and crdate fields as:

SELECT * FROM tt_content WHERE tstamp > crdate;

In api request, I could not find a solution. To get all the records and compare the fields in a loop, this is not a completed method, because it can be more than 2 million records (in my real case).

Thank you for your help.

+4
source share
1 answer

The only way I can think (and what the query builder supports) is with a direct suggestion. It will look like this:

$query = $contentElementRepository->createQuery();
$query->statement('SELECT * FROM tt_content WHERE tstamp > crdate');
$matchingContentElements = $query->execute();

, , , . statement() , , .

, , , .

+2

Source: https://habr.com/ru/post/1654607/


All Articles