salix/db/routines/dipole/views/expeditionControl.sql

12 lines
395 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `dipole`.`expeditionControl`
AS SELECT cast(`epo`.`created` AS date) AS `fecha`,
COUNT(0) AS `total`,
COUNT(`er`.`expeditionFk`) AS `leidas`
FROM (
`dipole`.`expedition_PrintOut` `epo`
LEFT JOIN `dipole`.`expedition_Read` `er` ON(`er`.`expeditionFk` = `epo`.`expeditionFk`)
)
GROUP BY cast(`epo`.`created` AS date)