SQL and sort order

Steve Albin steve at steve-albin.com
Thu Mar 2 09:11:38 CST 2006


On Thursday, March 2, 2006 ivan_smahin at valentina-db.com (Ivan Smahin) wrote:

>Hello Steve,
>
>Thursday, March 2, 2006, 3:30:14 PM, you wrote:
>
>> Is there any correlation between the order of requested fields in the SQL and the ORDER BY 
>claus?
>
>> I have this SQL:
>
>> select ax.*, artists.*,  players.* from ax, artists,  players 
>> where  players.nSessid = 1 and 
>> Players.nAxId = Ax.nId and 
>> players.nartid = artists.nid  
>> order by ax.nAxSort, Artists.nameidx, artists.nid
>
>> The ax.nSortOrd sorts correctly using this.
>
>> If I change the SQL to this:
>
>> select artists.*,  ax.*, players.* from ax, artists,  players 
>> where  players.nSessid = 1 and 
>> Players.nAxId = Ax.nId and 
>> players.nartid = artists.nid  
>> order by ax.nAxSort, Artists.nameidx, artists.nid
>
>> where artists fields come before ax, then the cursor does not sort correctly on ax.nSortOrd.
>
>> This is using Valentina 2.2 and RB2006 on the Mac.
>
>"ORDER BY" clause is not correlated to the column order in "SELECT list".
>But  you  have  mentioned  ax.nSortOrd which is not the part of "ORDER
>BY".

Doh!  I meant ax.nAxSort.  Sorry.


>
>> I will put a sample on Mantis, but I first wanted to make sure I
>> didn't have some dumb SQL misunderstanding.
>
>Put it please - so I will check it.

I will do this today.

Thanks,

Steve
--
Steve Albin - Montclair, NJ
http://www.jazzdiscography.com/
http://www.steve-albin.com/


More information about the Valentina mailing list