所以我已经将common_schema安装到我的mysql服务器上,并尝试使用get_option函数执行操作。
我的SQL:
SELECT *, ((get_option("program_invested_details", "received") * 100) / get_option("program_invested_details", "invested")) AS PERCENT_TOTAL FROM hp_programs_list WHERE program_add_status = 4 AND program_status = 1 ORDER BY PERCENT_TOTAL DESC
但似乎get_option函数不起作用,因为我收到了这个错误:
功能hyips_database.get_option不存在
我的数据库结构:
答案 0 :(得分:0)
一点点测试:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8
Server version: 5.5.31-0ubuntu0.13.04.1 (Ubuntu) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| common_schema |
| mydb |
| mysql |
| performance_schema |
| test |
+--------------------+
6 rows in set (0.00 sec)
mysql> SELECT * FROM `common_schema`.`status`\G
*************************** 1. row ***************************
project_name: common_schema
version: 2.2
revision: 523
install_time: 2015-01-01 00:00:01
install_success: 1
base_components_installed: 1
innodb_plugin_components_installed: 1
percona_server_components_installed: 0
install_mysql_version: 5.5.31-0ubuntu0.13.04.1
install_sql_mode: NO_AUTO_VALUE_ON_ZERO
1 row in set (0.00 sec)
mysql> USE `test`;
Database changed
mysql> SELECT `get_option`('{name: "Wallace", num_children: 0, "pet": Gromit}', 'pet') `result`;
ERROR 1305 (42000): FUNCTION test.get_option does not exist
mysql> SELECT `common_schema`.`get_option`('{name: "Wallace", num_children: 0, "pet": Gromit}', 'pet') `result`;
+--------+
| result |
+--------+
| Gromit |
+--------+
1 row in set (0.00 sec)