SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sort by lowest decimal value

    hi,

    i have a decimal(10,2) field. i want to sort my results accordin to the lowest decimal value. for example:
    25.00
    25.50
    26.00

    so i have this query:
    PHP Code:
    SELECT
    Price
    PromotionalOfferWebsiteBoroughMoreInfoBusinessName
    FROM
    client_boroughs
    JOIN
    client ON client_boroughs
    .idClient=client.idClient
    WHERE
    Borough 
    ='Southwark' order by (PriceASC
    so i am using order by (price) ASC to do this and it works, but is this the right way of doing this? is there a scenario where this could fail? should i be using somesort of math function to do this?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ma201dq View Post
    so i am using order by (price) ASC to do this and it works, but is this the right way of doing this?
    I'd use ORDER BY price ASC without the () around price.
    is there a scenario where this could fail?
    No
    should i be using somesort of math function to do this?
    No

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •