每个星期一我都会在SQLyog上为36个不同的客户运行脚本(所有客户都使用Linux服务器)。每天运行36个脚本非常耗时。
我想知道我是否可以在Linux上创建脚本(运行我总是在SQLyog上运行的脚本),然后将该输出作为XML文档导出到某个目录中。在此之后,我想安排一个Cron作业来运行该脚本并将结果通过电子邮件发送给我。
这是我在SQLyog上运行的MySQL脚本:
SELECT jobcard.`jobcard_number`,jobcard.`date_created`,
jobcard.`date_in`,jobcard.`date_completed`,em.`name` AS service_advisor,
jobcard.`salutation`,jobcard.`name`,jobcard.`surname`,
jobcard.`vehicle_reg`, vehicle.`make`,vehicle.`model`,vehicle.`type`,
job_definition.`name` AS job_definition, ep.`name` AS technician, job_event.`start_event`, job_event.`end_event`
FROM jobcard
LEFT JOIN vehicle
ON jobcard.`vehicle` = vehicle.`id`
LEFT JOIN employee em
ON em.`id` = jobcard.`service_advisor`
LEFT JOIN job
ON jobcard.`id` =job.`jobcard`
LEFT JOIN job_definition
ON job_definition.`id` = job.`job_definition`
LEFT JOIN employee ep
ON ep.`id` =job.`technician`
LEFT JOIN job_event
ON job.`id` = job_event.`job`
WHERE
jobcard.`date_in` BETWEEN '2017-05-15' AND '2017-05-19'
AND job_definition.`automatic` <>1