Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from equella/issue/10
#10: Add how to name parameters in Postgres Invoking 'lazy consensus'. Please open another PR if needed.
- Loading branch information
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Naming Parameters | ||
|
||
There are times when using the question mark syntax for bringing in parameters is not the best choice - a parameter might need to be used in multiple places, the number of parameters could make for a confusing SQL query, etc. After setting up the Report and Data Set parameters appropriately, use the following SQL example as a guide to 'name' the parameters directly in the query. | ||
|
||
```sql | ||
with vars as ( | ||
select | ||
?::date as startdate, | ||
?::date as enddate | ||
) | ||
select uuid, version, date_created from item | ||
where | ||
date_created >= (select startdate from vars) and | ||
date_created <= (select enddate from vars) | ||
``` |