Oscar SQL Tips

Here are some tips for using SQL commands.
You can run any SQL command that reads data (Ex. select) by using the Admin, oscarReport, Query By Example option.
You will see a window labelled 'Enter a Query'.  Enter your SQL commands and press Query to execute it.
If the syntax is invalid, nothing will happen.
(Ex. select count(*) from demographic to see how many records are in the demographic table )
If you want to export the results of your query, use the next option on the menu.  Admin, oscarReport, Report by Template.
This option will allow you to enter selection parameters and print or export the results to a .CSV or .XLS file .
Normally, you upload the templates from the oscarcanada.org site, but you can also create a Generic Report Wrapper which allows you to export the results of any query to a file. 

<report title="Generic Query Wrapper" description="Generic Query Wrapper for Ad-Hoc SQl queries" active="1">
<!-- put SQL command between 'query' and '/query' tags, below -->
select count(*) from demographic

All you have to do is copy your SQL query into the area between the 'query' tags.
If the SQL is invalid, you will see 'An SQL querry error has occured'. <sic>