Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MySQL (http://www.go4expert.com/forums/mysql-forum/)
-   -   Decimal Length Values (http://www.go4expert.com/forums/decimal-length-values-t6102/)

dynamo 29Aug2007 20:09

Decimal Length Values
 
Currently my Decimal length values are set to (15,2)

my figures are showing up as 1000.00

how can i add a comma so it looks like 1,000.00

also when im putting figures in Asc or Desc order its showing figures like 800.00 as higher than 1000.00

would the comma be the solution to this?

shabbir 30Aug2007 08:02

Re: Decimal Length Values
 
I don't think comma would solve the issue of 800 greater than 1000.

pradeep 30Aug2007 10:20

Re: Decimal Length Values
 
Commas wont solve the issue! Please post the query you are using, and the version of RDBMS!

jwshepherd 30Aug2007 10:31

Re: Decimal Length Values
 
Database sorting is very limited without extended query options. Otherwise it is very basic character by character. 1 is lower than 8

Windhan 10Jan2008 13:09

Re: Decimal Length Values
 
Quote:

Originally Posted by dynamo
Currently my Decimal length values are set to (15,2)

my figures are showing up as 1000.00

how can i add a comma so it looks like 1,000.00

also when im putting figures in Asc or Desc order its showing figures like 800.00 as higher than 1000.00

would the comma be the solution to this?

Code:

mysql> CREATE TABLE test_deci(id INTEGER NOT NULL PRIMARY KEY,val DECIMAL(10,2));
Query OK, 0 rows affected (0.31 sec)

Code:

mysql> INSERT INTO test_deci VALUES (1,100.00),(2,200.00),(3,300.00),(4,400.00),(5,500.00);
Query OK, 5 rows affected (0.00 sec)
Records: 5 Duplicates: 0 Warnings: 0

Code:

mysql> SELECT * FROM test_deci ORDER BY val ASC;
+----+--------+
| id | val    |
+----+--------+
|  1 | 100.00 |
|  2 | 200.00 |
|  3 | 300.00 |
|  4 | 400.00 |
|  5 | 500.00 |
+----+--------+
5 rows in set (0.00 sec)

Code:

mysql> SELECT * FROM test_deci ORDER BY val DESC;
+----+--------+
| id | val    |
+----+--------+
|  5 | 500.00 |
|  4 | 400.00 |
|  3 | 300.00 |
|  2 | 200.00 |
|  1 | 100.00 |
+----+--------+
5 rows in set (0.00 sec)

Works fine for me !!!!!!!1 :confused:

jrl.dharshana 25Jun2009 10:09

Re: Decimal Length Values
 
usefull ................thaks you very mech...Sir


All times are GMT +5.5. The time now is 14:57.