1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Decimal Length Values

Discussion in 'MySQL' started by dynamo, Aug 29, 2007.

  1. dynamo

    dynamo New Member

    Joined:
    Aug 29, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,293
    Likes Received:
    365
    Trophy Points:
    83
    I don't think comma would solve the issue of 800 greater than 1000.
     
  3. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    Commas wont solve the issue! Please post the query you are using, and the version of RDBMS!
     
  4. jwshepherd

    jwshepherd New Member

    Joined:
    Aug 13, 2007
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VP Technology Corporation
    Location:
    Texas
    Home Page:
    Database sorting is very limited without extended query options. Otherwise it is very basic character by character. 1 is lower than 8
     
  5. Windhan

    Windhan New Member

    Joined:
    Jan 9, 2008
    Messages:
    11
    Likes Received:
    3
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Chennai
    Code:
    mysql> [B]CREATE TABLE test_deci(id INTEGER NOT NULL PRIMARY KEY,val DECIMAL(10,2));[/B]
    
    Query OK, 0 rows affected (0.31 sec)

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

    Code:
    mysql> [B]SELECT * FROM test_deci ORDER BY val [COLOR=DarkRed]ASC[/COLOR];[/B]
    +----+--------+
    | 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> [B]SELECT * FROM test_deci ORDER BY val [COLOR=DarkRed]DESC[/COLOR];[/B]
    +----+--------+
    | 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:
     
    shabbir likes this.
  6. jrl.dharshana

    jrl.dharshana New Member

    Joined:
    Jun 25, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    usefull ................thaks you very mech...Sir
     

Share This Page