# NOT RUN {
## Example of an expicit join and use of group by and aggregates
# library(Rlabkey)
sql<- "SELECT AllTypesCategories.Category AS Category,
SUM(AllTypes.IntFld) AS SumOfIntFld,
AVG(AllTypes.DoubleFld) AS AvgOfDoubleFld
FROM AllTypes LEFT JOIN AllTypesCategories
ON (AllTypes.Category = AllTypesCategories.TextKey)
WHERE AllTypes.Category IS NOT NULL
GROUP BY AllTypesCategories.Category"
sqlResults <- labkey.executeSql(
baseUrl="http://localhost:8080/labkey",
folderPath="/apisamples",
schemaName="lists",
sql = sql)
sqlResults
# }
Run the code above in your browser using DataLab