Help:Creating SQL-queries
Moderator:Nobody (see all) Click here to sign up. |
|
Upload data
|
It is possible to create SQL-queries as links to Result Database using sql-query -tag.
Usage
Place your SQL-query between <sql-query> and </sql-query> -tags.
Example:
<sql-query>select * from Variable </sql-query>
Generates: <sql-query>select * from Variable </sql-query>
It is also possible use additional parameters:
- display (if set to "1" SQL-query is displayed in wikipage as preformatted text)
- name (name of the link, default is "Run query")
Example:
<sql-query display="1" name="What a great query">select * from Variable </sql-query>
Generates: <sql-query display="1" name="What a great query">select * from Variable </sql-query>
Note: Length of the query is limited to 255 characters
Alternative syntax:
This extension covers also Parser functions. This way it is possible to make SQL queries with parameters.
{{#sql-query:SELECT Var_name, Var_title, Var_unit, Run.Run_id, Run_date, Run_who, Run_method FROM Variable , Run_list, Run WHERE Variable.var_name = "Op_en{{PAGEID}}" AND Variable.var_id = Run_list.Var_id AND Run_list.Run_id = Run.Run_id GROUP BY Variable.var_id, Run.Run_id|Show the runs of this variable in Opasnet base}}
{{#sql-query:SELECT Var_name, Var_title, Var_unit, Run.Run_id, Run_date, Run_who, Run_method FROM Variable , Run_list, Run WHERE Variable.var_name = "Op_en2559" AND Variable.var_id = Run_list.Var_id AND Run_list.Run_id = Run.Run_id GROUP BY Variable.var_id, Run.Run_id|Show the runs of this variable in Opasnet base}}