Sorting Alphabetically

Discussion in 'C#' started by connectmobiles, Dec 20, 2006.

  1. #1
    I am very much a beginer in ASP. Today I thought I wannted to fiddle around with my ASP script. So, I want to display the items in alphabetical order..

    Can any one edit the following code to display the links generated in Alphabetical order???

     
    connectmobiles, Dec 20, 2006 IP
  2. venom

    venom Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could change the order by clause in your select statement

    
    sql1="select * from tbl_reviews order by rev_title asc"
    
    Code (markup):
     
    venom, Dec 21, 2006 IP
  3. connectmobiles

    connectmobiles Peon

    Messages:
    556
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thts for ascending order if Im not wrong...

    I want to display them Alphabetically...

    How do I do that???
     
    connectmobiles, Dec 22, 2006 IP
  4. bizoppz

    bizoppz Peon

    Messages:
    1,889
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That is how you would sort them alphabetically.
    sql1="select * from TABLE_NAME order by ROW_NAME asc"
    Code (markup):
    THE "order by ROW_NAME asc" tells your script to sort it alphabetically by ROW_NAME in ascending order
     
    bizoppz, Dec 22, 2006 IP
  5. connectmobiles

    connectmobiles Peon

    Messages:
    556
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #5
    okay I tried this... And It doesnt work...

    It executed as I had expected... The ordering just over turned...

    Currently the links occur according to a order as and when new ones are created. 'desc' and 'asc' are only changin the order from latest to oldest or oldest to latest....

    But I want to show my links in alphabetical order.. and not chronological order [according to their dates of creating].
     
    connectmobiles, Dec 23, 2006 IP
  6. Garve

    Garve Peon

    Messages:
    62
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Venom was correct with

    sql1="select * from tbl_reviews order by rev_title asc"

    Notice that he has changed rev_posted to rev_title

    You don't actually need to add asc as this is the default, so

    sql1="select * from tbl_reviews order by rev_title "

    will do.
     
    Garve, Dec 23, 2006 IP
  7. bizoppz

    bizoppz Peon

    Messages:
    1,889
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    0
    #7
    What is the name of the row that the links are in?
     
    bizoppz, Dec 23, 2006 IP