Just shooting out so no time to test. But could you try something like select substring(' ', 1, length(printf("%2.f", price))) || printf("%2.f", price) from prices
Paul www.sandersonforensics.com skype: r3scue193 twitter: @sandersonforens Tel +44 (0)1326 572786 http://sandersonforensics.com/forum/content.php?195-SQLite-Forensic-Toolkit -Forensic Toolkit for SQLite email from a work address for a fully functional demo licence On 4 April 2017 at 14:47, Hans M. van der Meer <drsme...@gmail.com> wrote: > Simon, thanks. > Now at last, I know how to continue. > > 2017-04-04 15:03 GMT+02:00 Simon Slavin <slav...@bigfraud.org>: > > > > > On 4 Apr 2017, at 11:25am, Hans M. van der Meer <drsme...@gmail.com> > > wrote: > > > > > I am building a simple bookkeeping. > > > With PHP and SQLite i now have tables and views with columns for values > > and > > > prices: not nicely aligned because decimal values are aligned different > > > from values that are interpreted as integers. > > > > Numeric values stored in a SQLite database should be stored as numbers. > > This allows you to do calculations on them. They should not have > alignment > > because they should not be text. > > > > > I like to create reports in which the column of prices and > > > *values are aligned to the right and all figures with two decimals > behind > > > the decimal point.* > > > I can not find a solution, so the question is how to achieve this > > > > SQLite is a database system. It is used for storing and retrieving > > information, not formatting it for people. When presenting your numbers > to > > people, do your formatting in PHP using sprintf() or vprintf(). > > > > http://php.net/manual/en/function.sprintf.php > > http://php.net/manual/en/function.vprintf.php > > > > See example #5 for sprintf() for "padding" which a word relating to > > alignment. > > > > Simon. > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@mailinglists.sqlite.org > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users