20 lines
543 B
SQL
20 lines
543 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`unary_tops`()
|
|
BEGIN
|
|
/**
|
|
* Devuelve todos los nodos que no tienen padre.
|
|
*
|
|
* @table tmp.tree Tabla con los ids de los nodos que no tienen padre;
|
|
**/
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.tree;
|
|
CREATE TEMPORARY TABLE tmp.tree
|
|
ENGINE = MEMORY
|
|
SELECT s.`unary_id` AS id, s.name, s.odbc_date, s.type
|
|
FROM `unary_scan` s
|
|
INNER JOIN `unary` u ON s.unary_id = u.id
|
|
WHERE u.parent IS NULL;
|
|
|
|
END$$
|
|
DELIMITER ;
|