[TYPO3-dev] pi_exec_query or exec_SELECTquery?

Gerrit Kamp gerrit.kamp at kampconsulting.com
Wed Jan 10 16:20:19 CET 2007


Team,

 

I am relatively new to Typo3 Extension development and I have two SQL
questions.

 

1. Alphabetically sorting of listview.

I  want to sort records in a listview alphabetically on a category, the name
of which is taken from another table through a foreign key. Kasper mentions
in one of his videos that he leaves it up to us to find out how to do it. I
have been struggling on this for a few days now, and I came to the following
conclusion:

 

If you use pi_exec_query, you have all the benefits of filtering out hidden
records and searchFieldList etc, but since the SELECT statement is defined
purely on the table and the fieldList, it is impossible to add the
categoryName from another table. So you are stuck with the categoryID, which
you cannot sort alphabetically.

 

Alternatively, using exec_SELECTquery, you can build any SQL statement you
want, but you loose the benefits of filtering out hidden or deleted records
and the searchFieldList.

 

Is my understanding correct? Any suggestions for how to proceed?

 

2. SQL Alias AS

I cannot get the SQL alias 'AS' functioning correctly in the
exec_SELECTquery. I read in a 2005 posting that aliases are not yet
incorporated in this function. Is that still the case?

 

Thanks!

 

Gerrit Kamp





More information about the TYPO3-dev mailing list