SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast Mary_Itohan's Avatar
    Join Date
    Dec 2004
    Location
    e-Planet
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Comparision with multiple characters

    hello,
    am using the below select statement.

    Code:
    SELECT * from history where receipient  like ('mary%')
    however i would like to compare with other people in my db e.g something to like this where receipient is like ('mary%' or 'dan%', or 'me%')

    how do i achieve this ?

    thanks
    Mary

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Just like you said it should look like this...

    PHP Code:
    <?php
    $query 
    "SELECT * FROM history";
    $query .= " WHERE receipient LIKE '%mary%'";
    $query .= " OR recipient LIKE '%john%'";
    $query .= " OR recipient LIKE '%joe%'";
    ?>
    -- Jelena --


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
  •