user2622247
user2622247

Reputation: 1089

write join query in php yii using CDBcriteria

Hi am quite new to php yii i have following query

select d.* from customer_service_provider csp inner join (select id_customers from customer_devices cd where id_devices=2) as c on csp.id_customers=c.id_customers inner join user_devices ud on ud.id_users = csp.id_users inner join devices d on d.id = ud.id_devices 

how can i write in to php yii using CDBcriteria

Upvotes: 2

Views: 429

Answers (1)

Daniel Vaquero
Daniel Vaquero

Reputation: 1305

you can't get 'devices' (d.*) FROM 'customer_service_provider' with $criteria and CActiveDataProvider.

Because CActiveDataProvider need a model to convert the query result in a list of objects of that model, but in this case you would have to pass the model 'customer_service_provider' class.

sorry for my english..

Upvotes: 1

Related Questions