
|
If you were logged in you would be able to see more operations.
|
|
|
|
File Attachments:
|
|
|
Environment:
|
Solaris Dev Express, Java 5
|
|
Issue Links:
|
Reference
|
|
|
|
This issue is related to:
|
|
DERBY-2351
ORDER BY with expression with distinct in the select list returns incorrect result
|
|
|
|
|
|
|
| Urgency: |
Blocker
|
| Bug behavior facts: |
Regression
|
| Resolution Date: |
22/Mar/08 01:39 AM
|
|
I am pasting here the communication from the mailinglist. I am having a blocking and large problem with it because I have to make a release that needs the specified SQL query.
tom_ wrote:
> The errormessage is
>
> The ORDER BY clause may not specify an expression, since the query specifies
> DISTINCT
> [Error Code: 20000]
> [SQL State: 4287A]
>
> The statement is
>
> select distinct
> t1.t1_id, t2.t2value1, t2.t2value2, t2.t2value3
> from
> t1, t2, t3
> where
> ...
> order by lower(t2.t2value2) , lower(t2.t2value1) , lower(t2.t2value3)
>
>
>
>
> Dyre.Tjeldvoll wrote:
>
>> tom_ <tom12167@...> writes:
>>
>>
>>> I am using "disctinct" because of some self-joins and also needed to add
>>> an
>>> "order by" clause. An error is shown. Is it not possible to use distinct
>>> and
>>> order by together?
>>>
>> I think it is allowed. Executing
>>
>> select distinct * from sys.systables order by tablename;
>>
>> in ij works just fine. Could you show the error message you get, and
>> perhaps what the table looks like?
>>
>> --
>> dt
>>
>>
>>
« [hide part of quote]
Hi Tom -
I see what you mean using the demo DB toursDB:
ij> select * from airlines order by lower(airline_full);
A&|AIRLINE_FULL |BASIC_RATE |DISTANCE_DISCOUNT
|BUSINESS_LEVEL_FACTOR
|FIRSTCLASS_LEVEL_FACT&|ECONOMY_SE&|BUSINESS_S&|FIRSTCLASS&
-----------------------------------------------------------------------------------------------------------------------------------------------------------
AA|Amazonian Airways |0.18 |0.03
|0.5 |1.5 |20 |10 |5
US|Union Standard Airlines |0.19 |0.05
|0.4 |1.6 |20 |10 |5
2 rows selected
ij> select distinct * from airlines order by lower(airline_full);
ERROR 4287A: The ORDER BY clause may not specify an expression, since
the query specifies DISTINCT.
ij> select distinct airline_full from airlines order by lower(airline_full);
ERROR 4287A: The ORDER BY clause may not specify an expression, since
the query specifies DISTINCT.
ij>
I didn't find a JIRA enhancement to remove this restriction. I suggest
you file an Enhancement request to remove the restriction reported by
ERROR 4287A.
|
|
Description
|
I am pasting here the communication from the mailinglist. I am having a blocking and large problem with it because I have to make a release that needs the specified SQL query.
tom_ wrote:
> The errormessage is
>
> The ORDER BY clause may not specify an expression, since the query specifies
> DISTINCT
> [Error Code: 20000]
> [SQL State: 4287A]
>
> The statement is
>
> select distinct
> t1.t1_id, t2.t2value1, t2.t2value2, t2.t2value3
> from
> t1, t2, t3
> where
> ...
> order by lower(t2.t2value2) , lower(t2.t2value1) , lower(t2.t2value3)
>
>
>
>
> Dyre.Tjeldvoll wrote:
>
>> tom_ <tom12167@...> writes:
>>
>>
>>> I am using "disctinct" because of some self-joins and also needed to add
>>> an
>>> "order by" clause. An error is shown. Is it not possible to use distinct
>>> and
>>> order by together?
>>>
>> I think it is allowed. Executing
>>
>> select distinct * from sys.systables order by tablename;
>>
>> in ij works just fine. Could you show the error message you get, and
>> perhaps what the table looks like?
>>
>> --
>> dt
>>
>>
>>
« [hide part of quote]
Hi Tom -
I see what you mean using the demo DB toursDB:
ij> select * from airlines order by lower(airline_full);
A&|AIRLINE_FULL |BASIC_RATE |DISTANCE_DISCOUNT
|BUSINESS_LEVEL_FACTOR
|FIRSTCLASS_LEVEL_FACT&|ECONOMY_SE&|BUSINESS_S&|FIRSTCLASS&
-----------------------------------------------------------------------------------------------------------------------------------------------------------
AA|Amazonian Airways |0.18 |0.03
|0.5 |1.5 |20 |10 |5
US|Union Standard Airlines |0.19 |0.05
|0.4 |1.6 |20 |10 |5
2 rows selected
ij> select distinct * from airlines order by lower(airline_full);
ERROR 4287A: The ORDER BY clause may not specify an expression, since
the query specifies DISTINCT.
ij> select distinct airline_full from airlines order by lower(airline_full);
ERROR 4287A: The ORDER BY clause may not specify an expression, since
the query specifies DISTINCT.
ij>
I didn't find a JIRA enhancement to remove this restriction. I suggest
you file an Enhancement request to remove the restriction reported by
ERROR 4287A.
|
Show » |
made changes - 06/Mar/08 03:13 PM
| Field |
Original Value |
New Value |
|
Derby Info
|
|
[Regression]
|
made changes - 06/Mar/08 08:25 PM
|
Issue Type
|
Improvement
[ 4
]
|
Bug
[ 1
]
|
made changes - 08/Mar/08 02:37 PM
|
Assignee
|
|
Bryan Pendleton
[ bryanpendleton
]
|
made changes - 19/Mar/08 02:19 PM
|
Fix Version/s
|
|
10.4.0.0
[ 12312540
]
|
made changes - 19/Mar/08 03:46 PM
|
Assignee
|
Bryan Pendleton
[ bryanpendleton
]
|
Dyre Tjeldvoll
[ dyret
]
|
made changes - 19/Mar/08 03:47 PM
|
Assignee
|
Dyre Tjeldvoll
[ dyret
]
|
Bryan Pendleton
[ bryanpendleton
]
|
made changes - 22/Mar/08 01:39 AM
|
Resolution
|
|
Fixed
[ 1
]
|
|
Fix Version/s
|
|
10.5.0.0
[ 12313010
]
|
|
Status
|
Open
[ 1
]
|
Resolved
[ 5
]
|
made changes - 04/May/09 06:22 PM
|
Fix Version/s
|
10.5.0.0
[ 12313010
]
|
|
|
Fix Version/s
|
|
10.5.1.1
[ 12313771
]
|
made changes - 30/Jun/09 03:55 PM
|
Bug behavior facts
|
|
[Regression]
|
|