# SQL Group By using SQLSelect

I would like to use the SQLSelect[] function in Mathematica 11 to get aggregated data from a large database. Is using SQLExecute the only way to specify GROUP BY? I'd like to use some of the nice SQLMemberQ[] filters to use previously calculated data from Mathematica in my queries, which is a pain when using SQLExecute.

The way it is now, I am using StringRiffle to convert my list of filter items to something that can be used in an SQLExecute:

filters = {"some","words","here"};
SQLExecute[conn,"SELECT col1, SUM(col2)
FROM tablename
WHERE col1 IN ('" <> StringRiffle[filters, "','"] <> "')
GROUP BY col1"
]


I'd like to be able to use something like:

SQLSelect[conn,"tablename",{"col1","SUM(col2)"},
SQLMemberQ[filters, SQLColumn["col1"]],
SQLGroupBy->SQLColumn["col1"]
]


Is there a way to specify this?

• Did you make a request to WRI for this feature? – Edmund Mar 14 '17 at 19:53