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

11 lines
270 B
SQL

CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`item_Free_Id`
AS SELECT `i1`.`id` + 1 AS `newId`
FROM (
`vn`.`item` `i1`
LEFT JOIN `vn`.`item` `i2` ON(`i1`.`id` + 1 = `i2`.`id`)
)
WHERE `i2`.`id` IS NULL
AND `i1`.`isFloramondo` <> 0