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

Reply via email to