Home Page » Active Record » Complex SQL
0
Votes
Solved!
Complex SQL
What is a good way to incorporate the following complex SQL into a Yii application?
- select * from (
- SELECT * FROM (
- SELECT * FROM tbl_extradata ORDER BY field1 DESC) AS s
- GROUP BY user_id) as ss
- where filterfield='IN'
select * from (
SELECT * FROM (
SELECT * FROM tbl_extradata ORDER BY field1 DESC) AS s
GROUP BY user_id) as ss
where filterfield='IN'Manually or is there a way to use CDbCriteria cleanly?
By mminnie in Active Record · Asked 523 days 15 hours 41 mins ago
Questions: 1 Accepted: 0 ( 0% ) | Reputation: 0
TAGS
actioncreate ( x 2 )ACTIVERECORD ( x 4 )AJAX ( x 10 )ajaxSubmitButton ( x 4 )AR ( x 2 )cactivedataprovider ( x 2 )CActiveForm ( x 2 )cactiverecord ( x 2 )CGridView ( x 14 )CJuiAutoComplete ( x 3 )CJuiDialog ( x 8 )CListView ( x 8 )controller ( x 7 )Css ( x 2 )CStarRating ( x 2 )CTreeView ( x 2 )database ( x 5 )dialog ( x 2 )dropdownlist ( x 3 )EGMaps ( x 3 )extension ( x 3 )file ( x 2 )form ( x 6 )Giix ( x 2 )gridview ( x 2 )html ( x 2 )javascript ( x 3 )many_many ( x 4 )merge ( x 2 )model ( x 4 )Modules ( x 3 )multilanguage ( x 2 )php ( x 2 )redirect ( x 4 )Registration ( x 3 )relations ( x 5 )renderPartial ( x 8 )session ( x 2 )sorting ( x 3 )sql ( x 4 )url ( x 3 )urlManager ( x 3 )validation ( x 3 )yii ( x 11 )YiiAnswers Site ( x 4 )This website counts Questions and 429 Answers by 7891 registered users.

For complex SQL I highly recommend the use of DAO: http://www.yiiframework.com/doc/guide/1.1/en/database.dao
By toni · 519 days 18 hours 43 mins ago
Questions: 0 Accepted: 0 ( 0% ) | Reputation: 0
Thanks. That looks perfect. I don't know why that didn't come up in all my searching.
By mminnie · 519 days 17 hours 22 mins ago