Yii Framework Forum: How To Combine Two Queries To The Database? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Combine Two Queries To The Database? Rate Topic: -----

#1 User is offline   RTJ 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 04-May 12

Posted 15 January 2013 - 02:31 PM

how to combine two queries to the database?
I need to join these two queries into one:


$a=DB::model()->findAll($criteria);
$b=DB:model()->findAll("a = 0");

php version is 5.2.17


and now need to join in a single queries $c to be sent to pager.

How I can do this?

thank you very much in advance
0

#2 User is offline   Emile Bons 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 19-September 11
  • Location:Tilburg, The Netherlands

Posted 15 January 2013 - 02:40 PM

Read some more about CDbCriteria and you will find out that it's easy to add 'a = 0' to the search criteria as the where clause or by using addColumnCondition.
0

#3 User is offline   RTJ 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 04-May 12

Posted 15 January 2013 - 02:42 PM

I need to order the first query and the second query to display the results after the first.

Some example?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users