Query for Items (advanced)
You just used the simple interface for querying for items. The advanced querying interface allows you to use SQL to query the database. If you don't know SQL, then this is your chance to learn.
1. Return to the Data Store Home Page.
2. Select the edit icon next to the Data Views heading and then the add icon next to the Advanced Queries heading.
3. In the Advanced Query page, use Ctrl-Click to select both the Treatment and Study Subject Data Classes to view details. Click the Display button.
4. A window will pop up displaying the database schema for these two Data Classes. The schema details must be used for creating the SQL query statement.
5. Enter the following SQL statement into the edit box:
SELECT s.subject_id "Subject Name",s.category "Addiction",s.sex "Gender",t.drug "Snack",t.amount "Number (per day)" FROM snack_Animal_Subject s, snack_Treatment t WHERE s.treatment=t.oid ORDER BY t.amount
6. Select the Submit button.
7. You will be directed to a table displaying the results from the SQL query.
Next you will save this query so that it can be easily accessed again in the future.