Results 1 to 9 of 9

Thread: need sql query

  1. #1
    Join Date
    Jun 2010
    Posts
    25
    Rep Power
    0

    Thumbs down need sql query

    hi ,

    i need sql query which will fetch both upper and lower case letter should be arranged in ascending order.For example i have records in DB like

    Arabic
    Bus
    arabia
    car
    Court
    employee
    Engine

    i need to sort those values and fetch and display in UI page.

    Arabic
    arabia
    Court
    car
    Engine
    employee

    like this.

    i have used

    Select * from topms_empdetails order by emp_name asc;

    but this query is fetching values like

    Arabic
    Court
    Engine
    arabia
    car
    employee


    please suggest me is there any sort procedure.Here i am using sql queries only not hibernate.I found that NLSSORT.But it is not satisfied my criteria.

    Thanks
    Murali
    Thanks&Regards,
    Muralikrishna K

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,452
    Rep Power
    20

    Default

    Have you tried this?
    Java Code:
    ORDER BY LOWER(emp_name) ASC
    db

  3. #3
    Join Date
    Jun 2010
    Posts
    25
    Rep Power
    0

    Default

    thanks for the reply.

    yes it is working
    Thanks&Regards,
    Muralikrishna K

  4. #4
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default

    add COLLATE LATIN1_GENERAL_CS after field name on ORDER BY
    Java Code:
    SELECT Field1
    FROM TABLE_NAME
    ORDER BY Field1 COLLATE LATIN1_GENERAL_CS;

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,452
    Rep Power
    20

    Default

    If your question is answered, please mark the thread as "solved" using the Thread Tools link near the top of the page.

    db

  6. #6
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default

    I thought you want this kind of order
    Arabic
    arabia

    NOT
    arabia
    Arabic

    Anyway, as DarrylBurke said, please mark the thread solve.

  7. #7
    Join Date
    Jun 2010
    Posts
    25
    Rep Power
    0

    Default

    how we can mark it as solved...
    Thanks&Regards,
    Muralikrishna K

  8. #8
    Join Date
    Jun 2010
    Posts
    25
    Rep Power
    0

    Post

    i made it as resolved.But i am trying to exceute query which was pasted here by you in TOAD.It was giving error like SQL command not properly ended.Is it support by oracle or is it for only sql server
    Thanks&Regards,
    Muralikrishna K

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,185
    Rep Power
    20

    Default

    NLS_SORT.
    It's a function that allows you to assign sort orders for different languages.

Similar Threads

  1. SQL query to HQL
    By alvin0618 in forum JDBC
    Replies: 3
    Last Post: 04-08-2011, 10:00 AM
  2. hql query
    By murali23krishna in forum JDBC
    Replies: 1
    Last Post: 03-17-2011, 08:25 AM
  3. I need help with a query.
    By Daredemo in forum JDBC
    Replies: 1
    Last Post: 08-13-2008, 06:16 AM
  4. Help in Query
    By geeta_ravikanti in forum JDBC
    Replies: 0
    Last Post: 03-31-2008, 02:16 PM
  5. Using sql:query tag
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-15-2008, 04:13 PM

Posting Permissions

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