MOVED mysql/company_get_owner.sql to mysql/core_company_get_owner.sql
authorAlan Knowles <alan@roojs.com>
Tue, 11 Oct 2016 03:04:58 +0000 (11:04 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 11 Oct 2016 03:04:58 +0000 (11:04 +0800)
mysql/core_company_get_owner.sql [new file with mode: 0644]

diff --git a/mysql/core_company_get_owner.sql b/mysql/core_company_get_owner.sql
new file mode 100644 (file)
index 0000000..29004bb
--- /dev/null
@@ -0,0 +1,12 @@
+DROP FUNCTION IF EXISTS company_get_owner;
+
+DELIMITER $$
+CREATE FUNCTION company_get_owner()  RETURNS INT(11) DETERMINISTIC
+    BEGIN
+        DECLARE v_id INT(11);
+        SET v_id = 0;
+        SELECT id INTO v_id  FROM Companies WHERE isOwner = 1 LIMIT 1;
+        RETURN v_id;
+    END $$
+DELIMITER ;
+