I have 2 table Customer and Customer Plan
Customer table
Id Name
1 John
2 Deol
3 test3
4 test4
Customer Plan table
id cust_id status
1 2 0
2 3 1
3 4 1
I want to get all customer ID and there Plan id (if exist)
get all the data by doing
$criteria->join ='where t.id NOT IN (select cust_id from customer_plan) or t.id in (select customer_id from customer_plan where foblu_customer_plan.babytel_status = 0)';
By this i get ID of customer table but i want to get both table unique ID
Create a relation in between Customer & CustomerPlan.
You can create a relation in model relations function.
Now use this relation to find out related records:
Get the relational records of Customer model: