-
in/like statement??
Hi Friends.
can't work this out, maybe someone can help.
I have the following query:
SELECT i.item_sc, i.item_n, b.bldng_room_sc
FROM item i, bldng_room b
where i.bldng_room_id = b.bldng_room_id
AND i.item_sc LIKE ('DIG00%','HUB00%','JET00%')
obviously the like statement is not going to work as it should be an IN statememt however the values have a wildcard in them.
can someone please help and tell me how to do this.
thanks
Once you have eliminated all of the impossible,
whatever remains however improbable,
must be true.
-
SELECT i.item_sc, i.item_n, b.bldng_room_sc
FROM item i, bldng_room b
where i.bldng_room_id = b.bldng_room_id
AND
(i.item_sc LIKE 'DIG00%' OR
i.item_sc LIKE 'HUB00%' OR
i.item_sc LIKE 'JET00%')
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
-
Thanks.
I tried that without the brackets and got thousands of results, all makes sense now.
Once you have eliminated all of the impossible,
whatever remains however improbable,
must be true.
-
or ...
SELECT i.item_sc, i.item_n, b.bldng_room_sc
FROM item i, bldng_room b
where i.bldng_room_id = b.bldng_room_id
AND SUBSTR(i.item_sc,1,5) IN ('DIG00','HUB00','JET00')
(and lets assume item_sc isn't indexed!)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|