Single Cactivedataprovider With Two Different Cdbcriteria

Before starting new topic i have checked with duplicate post and founded below post which i want.

http://www.yiiframework.com/forum/index.php/topic/26533-how-to-merge-two-cdb-criteria-results-into-one-and-use-it-in-the-cactive-dataprovider/

However, its not a better solution.

Let me explain my problem.

I have two tables

  1. Profile table (more then 2K records)

  2. Sample table (more then 3K records)

Both table structure are same and with another table join its give me data.

if i am going to implement solution with single CActiveDataProvider (as above solution),

  1. first it will load all the data Profile table (2K record in single array)

  2. it will load all the data Sample table (3K record in single array)

then it will merge both array and put it in custom array data provider.

so its taking time because fetching all the data (approx 5K records) and then provide me in single dataprovider.

Please provide me solution, hope this post will help me.

Major issue with loading time.

Thanks in advance.

Ravi Tatmiya

If the tables are EXACTLY the same you couldo do an UNION query combining two SELECT statements into one results set.

I would create a view in the database that returns data from both tables and create an ActiveRecord reading from that view.

thanks for your reply #nineinchnick

"Both table structure are same and with another table join its give me data."

  • sorry for miss understanding, what i mean that which 3 fields i need that are same in both tables, but other conditions are different like active / inactive, is_deleted and other criteria are different for both tables.

Please provide me brief for

  • I would create a view in the database that returns data from both tables and create an ActiveRecord reading from that view.