"Andrés G. Aragoneses" <[EMAIL PROTECTED]> wrote: > Andrés G. Aragoneses wrote: >> Igor Tandetnik wrote: >>> "Andrés G. Aragoneses" >>> <[EMAIL PROTECTED]> wrote: >>>> Hello, I am querying a list of elements and some of them are blank >>>> (''). However, I want that those who are blank appear as the last >>>> (instead of the first) elements when I sort with ORDER BY >>>> alphabetically. How can I do this with just SQL? >>> ORDER BY text = '', text >> >> It works thanks! > > Hugh, but this seems not to be applicable for different columns, > because, let's suppose I have: > > ItemId ItemName ItemNameSort > 1 'Balloon' 'balloon' > 2 '' '[noname]' > 3 'Car' 'car' > > If I use "ORDER BY ItemName = '', ItemNameLowered" I get 2,1,3 and I > want to get 1,3,2. Any ideas?
What's ItemNameLowered? Your table doesn't seem to have such a column. Have you tested it? I don't see how row 2 could appear first. You don't actually have apostrophes stored in the database as part of your data, do you? What does the following statement output: select ItemId, ItemName, length(ItemName) from myTable; Igor Tandetnik
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users