At my office I build a website using Yii framework. But I am still a newbie user in Yii programming. I have a problem with this query:
SELECT * FROM activity WHERE (((userId = 1 OR userId IN(SELECT userId FROM follower WHERE followerId = 1) AND activityType IN(1, 2, 3)) OR (targetId = 24 AND aType IN(1, 2, 3, 4, 5))) ORDER BY id DESC;
My question is how to make criteria with complex query in Yii framework?
I have query like this:
SELECT * FROM activity WHERE (((userId = 1 OR userId IN(SELECT userId FROM follower WHERE followerId = 1) AND activityType IN(1, 2, 3)) OR (targetId = 24 AND aType IN(1, 2, 3, 4, 5))) ORDER BY id DESC;I have try to use
model()->findAllBySql($sql)and it works. But I want to make it usingCDbCriteria, if you have another solutions let me know it![]()
Because I could not find the solution for this problem so I asked it on Stackoverflow and there some people give me the answer. I am quite happy that there are some people who want to provide solutions to those problems. I strongly advise you to ask questions about IT (programming) in Stackoverflow, because there are many people who are willing to provide the answer for you. What is interesting here also you you get some badges if you contribute to the Stackoverflow. This is my profile link at Stackoverflow.
So let’s give your contribution there and join a variety of people from different countries in a Stackoverflow’s community.
Stackoverflow is a website for IT Question and Answer. If you want to look for a IT support please visit this IT support blog website.