SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    May 2002
    Location
    RI-USA
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Where like with Values()

    Is it possible to to have a query that would be setup like this?

    PHP Code:
         mysql_query(" SELECT * FROM tabe where id like VALUES ('1', '5','20')"); 
    Or would it just be better to do it this way

    PHP Code:
         mysql_query(" SELECT * FROM tabe where id like '1' OR id like '5' OR id like '20'"); 
    Thanks for any help.

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Try the query below:

    SELECT * FROM table WHERE id IN(1, 5, 20)

    / Erik

  3. #3
    SitePoint Zealot
    Join Date
    May 2002
    Location
    RI-USA
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, exactly what I wanted.


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
  •