I am using following query:
SELECT `users`.`id` as id
FROM (`users`)
LEFT JOIN `work_orders`
ON `users`.`id` = `work_orders`.`assigned_to`
WHERE (work_orders.status = 'approved'
OR work_orders.status = 'scheduled'
OR work_orders.status = 'published')
AND work_orders.is_paid = 0
ORDER BY `users`.`id` DESC
LIMIT 30
But with this query I am getting multiple records for each users
if they have more than one work_orders
. What should I do to only list users
once which have more than one work_orders
?