select
workorder.*, tag.*,
concat(user_info.first_name, ' ', user_info.last_name) as assigned_to_user_str,
suppliers.company_name as assigned_to_supplier_str,
tag_categories.name as category_str,
locations.name as location_str
from tag, locations, tag_categories, workorder
left join user_info on workorder.assigned_to_user = user_info.id
left join suppliers on workorder.assigned_to_supplier = suppliers.supplier_id
WHERE workorder.tag_id = tag.tag_id and
workorder.location = locations.id and
workorder.prev_maint=1 and
tag_categories.id = workorder.category