salix/db/routines/vn/views/salesPreviousPreparated.sql

11 lines
320 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`salesPreviousPreparated`
AS SELECT `st`.`saleFk` AS `saleFk`
FROM (
`vn`.`saleTracking` `st`
JOIN `vn`.`state` `e` ON(`e`.`id` = `st`.`stateFk`)
)
WHERE `st`.`created` > `util`.`VN_CURDATE`()
AND `e`.`code` LIKE 'PREVIOUS_PREPARATION'