Issue Bug Resolved

#77862TYPO3 function select properties max and begin special keyword "total" not working with joined tables

Sinisa Mitrovic 09/06/16, 15:05 updated 09/28/26, 18:20

Description

Properties max and begin inside select function have special keyword “total” which should have total number of records.
In getQuery function in \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer first is to set limit and after that if there is no errors setting up table joins.
Limit use $queryParts[‘where’] and it cause problem if in where clause of select we have condition on joined table.
Here is example:

lib.someContent = CONTENT
lib.someContent {
table = tx_extension_domain_model_model2
select {
pidInList = 1
join = tx_extension_model1_model2_mm ON tx_extension_model1_model2_mm.uid_foreign = tx_extension_domain_model_model2.uid
where = tx_extension_model1_model2_mm.uid_local = 1
max = total – 1
}
}

In this example we will have error like unknown column tx_extension_model1_model2_mm.uid_local because in this step tables are not joined yet.

Reviews 2

History 24

  1. Riccardo De Contardi commented 09/26/21, 15:50

    On the latest documentation

    https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html#max

    I’ve found the line:

    > Special keyword: “total” is substituted with count(*) .

    I don’t know if this affects this issue…

  2. Gerrit Code Review pushed patch set 1 for main to change 96109 status New Under Review 09/27/26, 09:38

  3. Gerrit Code Review pushed patch set 1 for 14.3 to change 96134 09/28/26, 18:16

  4. Wouter Wolters commented and changed status Under Review Resolved done 0 % 100 % 09/28/26, 18:20

    Applied in changeset commit:993f54c11fb8cd78000345f177f7b31664c1e5f6.