I need some help understanding an example that was posted in DERBY-264. The example is:
SELECT i, j FROM t ORDER BY f ( j ) I understand all but " f ". Is that supposed to be "function"? It would be better if I could see a real world example of using this type of expression in the ORDER BY clause. Thanks! Laura On 2/19/07, Laura Stewart <[EMAIL PROTECTED]> wrote:
Thanks Yip, this helped alot. I will be posting a patch for DERBY-264 very soon. I'd appreciate it if you could take a look. Especially at the examples... Laura On 2/19/07, Yip Ng <[EMAIL PROTECTED]> wrote: > On 2/16/07, Laura Stewart <[EMAIL PROTECTED]> wrote: > > > 1. The type of expressions that are allowed. My impression is that > > they are the Boolean expressions (as opposed to TableExpressions or > > SelectExpressions)? > > ORDER BY expression is not limited to boolean expression only. It can contain > common value expression such as numeric, string, datetime, etc. It can also > have row value expression such as a scalar subquery, case expression, etc. > > > > 2. I need to understand how the Syntax for ORDER BY should appear. > > Should it just be "Expressions" added immediately after ColumnPosition > > (in both places in the Syntax? Or should it be specific type of > > expression (TableExpression, SelectExpression, Boolean Expression). > > Are there limitations as to the types of expressions allowed? Boolean, > > concatenation? > > Perhaps the name sort-key expression would be more appropriate? > Adding it after Column Position is fine. > > > 3. Description of the expressions allowed (will appear below the > > syntax) This will depend on what type of expressions are allowed, but > > one thing that the other parameters mention is if the column needs to > > be in the select list. I need help describing the expressions > > parameter. > > > > 4. Whatever type of expressions are allowed, that topic in the Derby > > Ref Guide needs to be updated too. Are there any limitations for ORDER > > BY? For example, the Boolean expressions topic mentions that there are > > limitations with check constraints. > > > > Yes, there are restrictions. If SELECT DISTINCT is specified or the > SELECT statement contains a GROUP BY clause, the ORDER BY columns need > to appear in the SELECT list. > > I think there is a bug in Derby in the DISTINCT with ORDER BY case and > I have filed a jira for this. See DERBY-2351 for further details. > > Hope this helps. > > Regards, > Yip Ng > -- Laura Stewart
-- Laura Stewart
