Count number of records returned by a subquery in monetdb
Hi, I try to execute a query like following: When I execute, select table_name from system order by table_name; no syntax error. But when I execute, select count(*) from (select table_name from system order by table_name) as count; I get syntax error, unexpected ORDER, expecting INTERSECT or EXCEPT or UNION or ')' in: "select count(*) from (select table_name from system order" What is the correct syntax? Regards, Ravi
MonetDB does not support order in sub-queries (mainly as order by has no semantically relevant meaning, but is rather for result rendering). Having said that, you query should work just fine without order by. Stefan ----- Original Message -----
Hi,
I try to execute a query like following:
When I execute, select table_name from system order by table_name; no syntax error.
But when I execute, select count(*) from (select table_name from system order by table_name) as count;
I get syntax error, unexpected ORDER, expecting INTERSECT or EXCEPT or UNION or ')' in: "select count(*) from (select table_name from system order"
What is the correct syntax?
Regards, Ravi
_______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
A bypass is to use a table producing function that sorts the result before returning. regards, Martin On 8/13/13 9:38 PM, Stefan Manegold wrote:
MonetDB does not support order in sub-queries (mainly as order by has no semantically relevant meaning, but is rather for result rendering).
Having said that, you query should work just fine without order by.
Stefan
----- Original Message -----
Hi,
I try to execute a query like following:
When I execute, select table_name from system order by table_name; no syntax error.
But when I execute, select count(*) from (select table_name from system order by table_name) as count;
I get syntax error, unexpected ORDER, expecting INTERSECT or EXCEPT or UNION or ')' in: "select count(*) from (select table_name from system order"
What is the correct syntax?
Regards, Ravi
_______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
participants (3)
-
Martin Kersten
-
Ravikumar Balasubramaniam
-
Stefan Manegold