How to update a record based on the column value of another table in Yii


I have 2 tables. One for profiles and one for users. What I'm trying to achieve is to update a field in profiles table, based on a condition in users table.

I want to finally achieve to the following query:

UPDATE profile
   SET p.cost = 1200
FROM Profile p
   INNER JOIN users u ON p.user_id =
WHERE u.status = 1

Simply you can use TRIGGERS in your SQL or MYSQL. so you can do all actions on another or related tables like - INSERT, UPDATE & DELETE.

eg. -