Hi,
Whats is the syntax of grouping sets in monetdb? I am trying Select has_nurs,form,health,class,count(*) from nursery group by GROUPING SETS ((has_nurs,class),(form,class),(health,class)) but it does not work
Regards Nafees Ur Rehman
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Op 15-04-10 13:27, Nafees Ur Rehman schreef:
Whats is the syntax of grouping sets in monetdb? I am trying /Select has_nurs,form,health,class,count(*) from nursery group by GROUPING SETS ((has_nurs,class),(form,class),(health,class))/ but it does not work
It does not seem to be defined in SQL92 http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt, thus it is not (yet) supported. Probably the best thing to do is to add a feature request on Sourceforge for it.
Stefan
On Thu, Apr 15, 2010 at 04:27:55AM -0700, Nafees Ur Rehman wrote:
Hi,
Whats is the syntax of grouping sets in monetdb? I am trying Select has_nurs,form,health,class,count(*) from nursery group by GROUPING SETS ((has_nurs,class),(form,class),(health,class)) but it does not work
As far as I know, MonetDB does not support "GROUPING SETS" (yet?). Hence, you'd have to rewrite your query to "UNION ALL" several queries that do the individual groupings; e.g., your example:
SELECT has_nurs,form,health,class,count(*) FROM nursery GROUP BY GROUPING SETS ((has_nurs,class),(form,class),(health,class))
as follows:
SELECT has_nurs,form,health,class,count(*) FROM nursery GROPU BY has_nurs,class UNION ALL SELECT has_nurs,form,health,class,count(*) FROM nursery GROPU BY form,class UNION ALL SELECT has_nurs,form,health,class,count(*) FROM nursery GROPU BY health,class;
Feel free to file a feature request in case you would like to see "GROUPING SETS" in some future release of MonetDB/SQL (tough I cannot make any promises right now ...)
Stefan
Regards Nafees Ur Rehman
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Thanks for the tip.
Regards
Nafees
On Thu, Apr 15, 2010 at 04:27:55AM -0700, Nafees Ur Rehman wrote:
Hi,
Whats is the syntax of grouping sets in monetdb? I am trying Select has_nurs,form,health,class,count(*) from nursery group by GROUPING SETS ((has_nurs,class),(form,class),(health,class)) but it does not work
As far as I know, MonetDB does not support "GROUPING SETS" (yet?). Hence, you'd have to rewrite your query to "UNION ALL" several queries that do the individual groupings; e.g., your example:
SELECT has_nurs,form,health,class,count(*) FROM nursery GROUP BY GROUPING SETS ((has_nurs,class),(form,class),(health,class))
as follows:
SELECT has_nurs,form,health,class,count(*) FROM nursery GROPU BY has_nurs,class UNION ALL SELECT has_nurs,form,health,class,count(*) FROM nursery GROPU BY form,class UNION ALL SELECT has_nurs,form,health,class,count(*) FROM nursery GROPU BY health,class;
Feel free to file a feature request in case you would like to see "GROUPING SETS" in some future release of MonetDB/SQL (tough I cannot make any promises right now ...)
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
participants (3)
-
Nafees Ur Rehman
-
Stefan de Konink
-
Stefan Manegold