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:

          SQLMemberQ[filters, SQLColumn["col1"]], 

Is there a way to specify this?


Posted 2017-01-30T10:20:50.743

Reputation: 21

Did you make a request to WRI for this feature? – Edmund – 2017-03-14T19:53:59.320

No answers