Ordering items in a slot

I’m trying to display an index of items in a folder. There’s an auto-slot defined with a sql query to collect all items there, ordered alphabetically by item name. However, when initializing this slot in my template (#initslot() ), for some reason items are always ordered by content id, no matter what I do in the query. Interestingly enough, “order by” clause is accepted, but ineffective. Am I doing something wrong or there is a workaround?

My mistake: sorting is correctly done, however it’s case-specific (uppercase items are sorted and listed first, then lowercase).