|
I'm using Oracle. What's the best way to do something similar to WHERE name IN (a set of values), except instead of checking for equality, we use the LIKE keyword? It would end up being functionally the same as WHERE name LIKE val1 OR name LIKE val2 OR name LIKE val3, except the number of right hand values can change. Currently, what I'm doing is pre-preparing the SQL by iterating over the list of possible names (which are not retrieved from the DB) and appending "OR name LIKE ?" each time.
|
# ¿ Nov 9, 2007 07:50 |
|
|
# ¿ Apr 29, 2024 07:49 |
|
minato posted:Perhaps you can build a more general Perl-compatible regex, and that'll only use 1 statement? E.g.: Ah, great. That sounds cleaner than mine; the sets I'm expecting aren't all that large so it shouldn't waste too much time. Thanks.
|
# ¿ Nov 9, 2007 08:56 |
|
fletcher posted:What does the INNER do? What happens if you take it out? The inner join is a type of join, and as far as I know, the default one used when you omit the inner. It just matches each row in the first table against each in the second. You would use other kinds of joins for the cases not covered by inner joins--for instance, if you had a table of books, and its foreign key to the authors table for some reason points to a nonexistent row, you could use an outer join to list each book next to either its author's name or some string like "NULL" if the author doesn't exist. An inner join would miss this case; there's an example in that link I gave you.
|
# ¿ Nov 21, 2007 13:08 |