Results 1 to 3 of 3

Thread: SQL Statement Sorting LastName by A, B, C ...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Location
    Germany, New Zealand, now in Australia
    Posts
    143

    Question SQL Statement Sorting LastName by A, B, C ...

    Hi there,

    How would I be able to set the SQL Statements so that I have the LastName by A, B, C ... SORTED and NOT by the ID as it is now ???.

    VB Code:
    1. Public Function FillList()
    2. '---
    3.     str_SQL = "SELECT ID, LastName+', '+FirstName FROM tblAddr"
    4.  
    5. End Function


    VB Code:
    1. Public Function GetAddressDetails()
    2.  
    3.     str_SQL = "SELECT * FROM tblAddr Where ID =" & lngAddrID
    4.  
    5. End Function

    Thanks aktell GER/NZ

  2. #2
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    str_SQL = "SELECT ID FROM tblAddr ORDER BY LastName"

    don't get though if LastName and FirstName are two different fields, the LastName+', '+FirstName remains a mistery to me
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: SQL Statement Sorting LastName by A, B, C ...

    This will order by LastName, then Firstname when the LastNames match
    VB Code:
    1. str_SQL = "SELECT ID, LastName+', '+FirstName FROM tblAddr ORDER BY LastName, FirstName"
    VB Code:
    1. str_SQL = "SELECT * FROM tblAddr Where ID =" & lngAddrID + " ORDER BY LastName, FirstName"

Posting Permissions

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



Click Here to Expand Forum to Full Width