ORDER BY

Ivan Smahin IvanSmahin at public.kherson.ua
Sat Aug 7 12:44:32 CDT 2004


Hello Ruslan,

Saturday, August 7, 2004, 8:44:08 AM, you wrote:

RZ> On 8/7/04 2:18 AM, "jda" <jda at his.com> wrote:

RZ> Hi Jon,

>> In V1.x I could ORDER a cursor by a field I did not select.
>> 
>> It seems that this causes an error in V2.0. Is that correct -- it is
>> no longer allowed and you must select the field you ORDER by?

RZ> Hmm, as I remember, on start Valentina 1.x did allow this.
RZ> Later when GROUP BY was implemented Valentina 1.x also prohibit this.
RZ> So are you sure that in Valentina 1.10 you could do this ?!

RZ> And yes. SQL92 do not allow this.
RZ> Because ORDER BY sorts NEW result table in general case.

RZ> Because ORDER BY also have syntax

RZ>     ORDER BY 1, 2 

RZ> To refer fields from SELECT rule.


>> And secondly, if so, I think this might be the cause of the "field
>> not found" error I reported earlier -- I was sorting by a method
>> (although the field the method sorted by was in fact selected...).

RZ> Ivan,

RZ> Add Please test 

RZ> SELECT f1, f2
RZ> FROM T
RZ> ORDER BY f3

RZ> And check what error is throw,
RZ> And it seems that error message do not display name "f3"


Tests are added and passed correctly.

1.
SELECT f1, f2
FROM T
ORDER BY f3

2.
SELECT f1, f2
FROM T
ORDER BY 3


Some minor changes have been done in the Node_Select_OrderBy_Elem node
and void Node_Select::DoSorting( void ) method.




-- 
Best regards,
 Ivan                            mailto:IvanSmahin at public.kherson.ua



More information about the Valentina-beta mailing list