Where To Put Complex Queries?

I am still pretty new to MVC and Yii and I have a general Yii/MVC question. Usually most of my models are representative of single db tables or input forms. My question is in what model would I put a complex query that joins a bunch of tables and maybe has some embedded SELECT statements in it if it doesnt match up with an individual db table or input form? Say I have a users, cars, payments tables and I want to dislay a combination of that data in a view, in what model would I put that query?

Usually you can always choose one ‘main’ table.

For example, if your controller’s main task is to display users (with some extra info - cars, payments and so on) then the ‘main’ model would be User. And if it displays cars (added by users) then you can choose Car.

Basically, it’s all about relations.