May 19, 2014, 11:33am
i have 3 tables
"worker","activity" and linking table "workerToActivity"
activity has ‘time’ and ‘activity_id’ Columns
worker has ‘worker_id’ Column
workerToActivity has ‘worker_id’ and 'activity_id’Columns
in my query i want to get all workers that are
not register to activity in certain time,
i dont know how to do that
can u help me?
May 19, 2014, 12:49pm
In my cases in the past I used something like that
But when the queries became more comblex I use this one
Yii::app()->db->createCommand('a comblex query')->queryAll()
So you have to check both of two options
May 20, 2014, 8:31am
FROM worker a
LEFT JOIN workerToActivity b ON b.worker_id=a.worker_id
LEFT JOIN activity c ON c.activity_id=b.activity_id
WHERE b.activity_id IS NULL --no activity assigned
OR NOT (c.time BETWEEN .. AND ..)
May 21, 2014, 8:02am
conapaz & Joblo
u both help me alot, thnks.