SELECT company_names.name_ru name_ru,
company_names.new_or_update new_or_update,
company_names.paid paid,
company_updates.uniq_id uniq_id,
company_updates.users_login users_login,
company_updates.last_date last_date,
company_updates.update_date update_date,
company_updates.company_names company_names,
company_updates.company_informations company_informations,
company_updates.company_coordinates company_coordinates,
company_updates.company_services company_services,
company_updates.company_services_products_prices company_services_products_prices,
company_updates.company_discounts_services company_discounts_services,
company_updates.company_alboms_services company_alboms_services,
company_updates.company_images_services company_images_services,
company_updates.company_products company_products,
company_updates.company_discounts_products company_discounts_products,
company_updates.company_alboms_products company_alboms_products,
company_updates.company_images_products company_images_products
FROM life_updates as company_updates, tmp_names as company_names
WHERE company_updates.company_names = 1
or company_updates.company_informations = 1
or company_updates.company_coordinates = 1
or company_updates.company_services = 1
or company_updates.company_services_products_prices = 1
or company_updates.company_discounts_services = 1
or company_updates.company_alboms_services = 1
or company_updates.company_images_services = 1
or company_updates.company_products = 1
or company_updates.company_discounts_products = 1
or company_updates.company_alboms_products = 1
or company_updates.company_images_products = 1
and company_updates.uniq_id = company_names.uniq_id
and company_updates.users_login = company_names.users_login
group by company_names.uniq_id
order by update_date asc ;