Thanks for your advice. I have already played with associations, but I could not figure out, how I can get the number of comments associated with each post. (see the query I presented in the initial post) In the source code of the CakePHP framework I discovered an attribute "counterQuery" (part of the hasMany array), but it seems that the functionality isn't implemented yet.
But to get back to the inital question: Suppose a certain very complex query cannot be rewritten with the use of associations: How can I refer to table names in a flexible manner, so that prefixes are added by the framework automatically? > Yes - you need to look into associations, but it's not that hard: > Here's a good starting point > http://wiki.cakephp.org/tutorials:book_titles. > > If you set DEBUG to 2, you will see all the SQL queries at the bottom > of your page. > > Cheers, > > AD7six --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---