|
Home > Archive > MySQL ODBC Connector > September 2005 > how to format(x,d) right justified ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to format(x,d) right justified ?
|
|
| C.R. Vegelin 2005-09-26, 7:23 am |
| ------ =_NextPart_000_0014_
01C5C290.8E5E21A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi All,
Does anyone know how to use the format() function in such a way that is =
displays numbers right justified.
For example, see the following query, where I want no decimal places:
SELECT 123456.789 AS X, FORMAT(123456.789, 0), FORMAT(123456.789, 0)+0;
The 1st column is normally displayed as 123456.789
The 2nd column is displayed as string (left justified) as 123,457
BUT the 3rd column, using +0 to force right-justified, cuts off valid =
data and displays only 123=20
Cor
------ =_NextPart_000_0014_
01C5C290.8E5E21A0--
| |
| Jigal van Hemert 2005-09-26, 7:23 am |
| C.R. Vegelin wrote:
> Hi All,
>
> Does anyone know how to use the format() function in such a way that is displays numbers right justified.
> For example, see the following query, where I want no decimal places:
> SELECT 123456.789 AS X, FORMAT(123456.789, 0), FORMAT(123456.789, 0)+0;
> The 1st column is normally displayed as 123456.789
> The 2nd column is displayed as string (left justified) as 123,457
> BUT the 3rd column, using +0 to force right-justified, cuts off valid data and displays only 123
Hi Cor,
I would use the ROUND() function to do the rounding, as it returns
values with the same type as the first argument.
http://dev.mysql.com/doc/mysql/en/m...-functions.html
Regards, Jigal.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
|
|
|
|
|