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

18 lines
512 B
SQL

CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemSearch`
AS SELECT `s`.`itemFk` AS `itemFk`,
`s`.`concept` AS `concept`,
`s`.`quantity` AS `quantity`,
`t`.`nickname` AS `nickname`,
`t`.`shipped` AS `shipped`
FROM (
(
`vn`.`sale` `s`
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `s`.`ticketFk`)
)
JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`)
)
WHERE `t`.`shipped` BETWEEN `util`.`yesterday`() AND `util`.`tomorrow`()
AND `w`.`name` IN ('VNH', 'Floramondo')