After more Googling, I found this tidbit which simulates lpad for sqlite:

substr('0000000000' || mycolumn, -10, 10)

Thanks!

Josh

> Hello all,
>
> The simple question is, is there any way in SQLite to format (left align)
> integers? So for example I want to print 1 as 00001, 23 as 00023, 102 as
> 00102, etc.
>
> The real issue I'm trying to solve is a sorting one. I run some SQL which
> takes some integers and creates a column for sorting with data like
> following:
> 1.1.2.3
> 1.2
> 1.12.4
>
> It gets sorted as follows, (whereas I want it sorted as above):
> 1.1.2.3
> 1.12.4
> 1.2
>
> Hence if I could left align the printing of the integers it would sort
> correctly, but if there is another way to get the sorting I want, I could
> use something else...
>
> Thanks!
>
> Josh
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to