Div |
---|
|
On this page Table of Contents |
---|
maxLevel | 1 |
---|
exclude | On this page |
---|
type | flat |
---|
separator | pipe |
---|
|
|
Macros
- SQL Macro
- SQL-query Macro - performance optimized for read-only SQL statements
- SQL-file Macro - locked to just run administrator defined queries
Usage
No Format |
---|
{sql-query:dataSource=TestDS|output=wiki}
select * from test
{sql-query}
|
No Format |
---|
There are *{sql-query:dataSource=TestDS|table=false} select count(*) from test01 {sql-query}* rows in table test01
|
No Format |
---|
{sql-query:dataSource=TestDS|p1=%test%|showsql=true}
select * from test01 where a1 like ?
{sql-query}
|
Example chart from Site statistics
No Format |
---|
{chart:title=Confluence Content|type=pie|displayData=true|width=500|height=300
|dataOrientation=vertical|pieSectionLabel=%0% - %1%|legend=false|
tables=content|attachment=Confluence content.png}
{sql:dataSource=confluenceDS|id=content}
select contenttype as Type, count(distinct CONTENT.title) as "Count"
from CONTENT
group by contenttype
having count(distinct CONTENT.title) > 0
union
select contenttype as Type, count(*) as "Count"
from CONTENT
where contenttype='COMMENT'
group by contenttype
having count(*) > 0
union
select 'ATTACHMENTS' as Type, count(distinct title) as "Count"
from ATTACHMENTS
order by "Count" DESC
{sql}
{chart}
|
Confluence 3.x wiki macros
Duplicate macros are available for Confluence 3.x style wiki markup for recursive use.
- sql1 - duplicate of sql for recursive use
- sql2 - duplicate of sql for recursive use
- sql3 - duplicate of sql for recursive use
- sql-query1 - duplicate of sql-query for recursive use
- sql-query2 - duplicate of sql-query for recursive use
- sql-query3 - duplicate of sql-query for recursive use
Image Removed
Image Removed
Security
...
- The sql and sql-query macros are controlled separately. The duplicate macros (sql1, sql2, sql-query1, etc...) cannot be configured separately as they inherit from the macro they duplicate.
...
Click on one of the following to get step-by-step guides, examples, or recipes for using SQL for Confluence:
Child pages (Children Display) |
---|