Help:Creating SQL-queries: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(created help-page)
 
(Added category: 'Help')
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:SQL tool]]
[[Category:Open assessment]]
{{method}}
It is possible to create SQL-queries as links to Result Database using '''sql-query''' -tag.
It is possible to create SQL-queries as links to Result Database using '''sql-query''' -tag.


Line 30: Line 33:


'''Note:''' Length of the query is limited to 255 characters
'''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.
<nowiki>
{{#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}}
</nowiki>
{{#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}}
[[Category:Help]]

Latest revision as of 12:10, 6 April 2011


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}}