kohana / database

A Kohana module for database interactions, building queries, and prepared statements
http://kohanaframework.org/documentation
158 stars 140 forks source link

Incorrect usage of UNION and ORDER BY without parenthesis #55

Closed misterx closed 10 years ago

misterx commented 11 years ago

When use ORDER BY with UNION, give error Incorrect usage of UNION and ORDER BY. http://stackoverflow.com/a/6732697

kwn commented 10 years ago

+1

shadowhand commented 10 years ago

Does this have a redmine issue?

misterx commented 10 years ago

No

acoulton commented 10 years ago

@misterx thanks for this contribution and sorry it's been left open so long. We'd need to take this into 3.3/develop rather than 3.3/master - I can apply that manually rather than asking you to close and reopen but can you confirm that the new syntax is valid in all the supported database engines? SQL isn't my strong point.

enov commented 10 years ago

I guess it's a :+1: from me. Regarding the syntax, it just adds parenthesis around the SELECT sub-queries, in order to remove the ambiguity. That should be supported by all the db engines.

acoulton commented 10 years ago

@misterx @enov thanks - applied to 3.3/develop in c53d8aaa