Hi all together,
I am migrating an SQL project to SQLCE 3.5
A statement like
(SELECT <column_list> FROM Table AS a
WHERE <where_clause1>
ORDER BY a.column)
UNION
(SELECT <column_list> FROM Table AS b
WHERE <where_clause2>
ORDER BY b.column DESC)
produces an error at the first "ORDER" token:
"There was an error parsing the query. [ Token line number = 1,Token
line offset = 133,Token in error = ORDER ]"
Source="SQL Server Compact ADO.NET Data Provider"
Doesn't SQLCE support UNIONs with ORDERing statements?
Thank you for your hints!
Michael
chora - 08 Jan 2008 06:53 GMT
I suppose a.column is the same with b.column right? I believ you cannot
have a different sort column in a union, because there is a single
result set. I cannot test it right now, but I believe the ORDER BY can
exist in only one of the queries. The sorting will affect the entire
set.