salix/db/routines/hedera/views/myTicketState.sql

22 lines
648 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `hedera`.`myTicketState`
AS SELECT `t`.`id` AS `id`,
`t`.`clientFk` AS `clientFk`,
`t`.`warehouseFk` AS `warehouseFk`,
`t`.`shipped` AS `shipped`,
`t`.`landed` AS `landed`,
`t`.`nickname` AS `nickname`,
`t`.`agencyModeFk` AS `agencyModeFk`,
`t`.`refFk` AS `refFk`,
`t`.`addressFk` AS `addressFk`,
`t`.`location` AS `location`,
`t`.`companyFk` AS `companyFk`,
`ts`.`alertLevel` AS `alertLevel`,
`ts`.`code` AS `code`
FROM (
`vn`.`ticket` `t`
LEFT JOIN `vn`.`ticketState` `ts` ON(`ts`.`ticketFk` = `t`.`id`)
)
WHERE `t`.`clientFk` = `account`.`myUser_getId`()