SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    webality...dunno what it means bcp_2005's Avatar
    Join Date
    Jun 2002
    Location
    Huntsville Alabama
    Posts
    394
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Regular Expressions?

    Hi. I've got a problem. Probably a simple solution but I'm obviously missing something. Ok so here's what I'm trying to do. I've got a database with different names in it. First in last name in the same data table. The entries are like this:

    Lastname, Firstname

    Now, I want to display only those names whose last name start with the letter 'a'. How would I do this? I thought that I might out to use regular expressions. But I'm not sure. Any help would be appreciated!

    -Bryan
    [ metabahn ] : changing the course of the web.

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can do that in your database query, like this:
    Code:
    SELECT lastname, firstname
    FROM your_table
    WHERE lastname LIKE 'a%'
    The 'a%' means anything that starts with 'a'.


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
  •