Hi Hannes,

That's not always the case; how about something like getting the names of all order items sold by the top 5 salesmen by order count, using a query like this:

select item_name 
from orders
where salesman_id in (
  select salesman_id 
  from order_counts
  order by order_count desc
  limit 5)

Or do you mean that it's a non-standard SQL extension to allow order by / limit in subqueries?

thanks,
Pete.
  


On 4 October 2013 15:33, Hannes Mühleisen <Hannes.Muehleisen@cwi.nl> wrote:
Hello Hadley and list,

ORDER BY (and LIMIT/OFFSET for that matter) only control the overall shape of the query result set. Hence, they are indeed not supported within subqueries in MonetDB.

Best,

Hannes




On 10/04/2013 04:22 PM, Hadley Wickham wrote:
Currently, monetdb fails on this query:

SELECT * FROM (SELECT *
FROM "Batting"
ORDER BY "playerID")

with

syntax error, unexpected ORDER, expecting INTERSECT or EXCEPT or UNION
or ')' in: "select * from (select *

(obviously that query isn't very useful, but it makes it harder to
automatically generate sql)

In case it matters, that query (with minor escaping variations) works
in sqlite, postgres and mysql.

Hadley




_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list