Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Location
    Midland, Michigan
    Posts
    7

    Unanswered: Using 'LIKE' and 'IN' in the same where clause

    I have a table of filenames, and I want to look for filenames with the extension of .png, ,tif ,gif, .jpg, etc. What I don't want to do is:

    select id, name from data_file where upper(name) like upper('%.png') or upper(name) like upper('%.gif');

    What I would like is: select id, name from data_file where upper(name) like in ('%.png','%.gif','%tif')

    Thanks

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    where right(lower(name),4) in ('.jpg','.png',...)

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    May 2003
    Location
    Midland, Michigan
    Posts
    7
    Excellent! I should have specified Oracle, but I can use SUBSTR.
    where SUBSTR (lower(name),-4) in ('.jpg','.png','.tif');

    Thanks....

Posting Permissions

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