473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to run a LIKE query with multiple values?

Hi,

I have following problem. I have to run a query where one of the result fields should be within range of values I got from different table.

Query 1

select column_x from table1 where filed_x = 'Y'

this query gives me 33 different alphanumeric values

Query 2

select column1,
column2,
column3
from table2 where
column3 like '%ONE OF VALUES FROM QUERY1'

I am quite fresh in SQL and I really need help with this one. The problem is, that column3 in table2 can hold not only the exact values received from query1, but also values from query1 with little prefixes. Do you know any way to get this working?

Thanks for any comments. MArcin
Nov 5 '10 #1
2 17594
rski
700 Expert 512MB
Maybe like that
Expand|Select|Wrap|Line Numbers
  1. select table2.column1,
  2. table2.column2,
  3. table2.column3
  4. from table2,table1 where
  5. table1.filed_x = 'Y'
  6. and
  7. table2.column3 like '%'||table1.column_x; 
  8.  
o to chodziło :) ?
Nov 5 '10 #2
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT t2.column1,
  3. t2.column2,
  4. t2.column3
  5. FROM table1 t1,table2 t2
  6. WHERE INSTR(t2.column3,t1.column_x,1,1) > 0
  7. AND   t1.field_x = 'Y'
  8. /
  9.  
Nov 8 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kgould | last post by:
I'm trying to use XMLStarlet to pull a value out of Microsoft's mssecure.xml file for patch availability. I'm an XML newb, so I'm struggling here. I want to pull the @Summary field value- I'm...
2
by: Jen F. | last post by:
I have inherited a medical database in which there are multiple values stored in a single field (ie. "Current Conditions" field might contain 1-20 different conditions, separated by comma (ie....
5
by: Homer Simpson | last post by:
Hi All, I'm trying to write a method where I pass three arguments and the method returns six values. All the values will be doubles. First, is it possible to get multiple values returned by a...
16
by: Nikolay Petrov | last post by:
How can I return multiple values from a custom function? TIA
9
by: Karl O. Pinc | last post by:
I want to return multiple values, but not a set, only a single row, from a plpgsql function and I can't seem to get it to work. (I suppose I'd be happy to return a set, but I can't seem to make...
8
by: Chris A via AccessMonster.com | last post by:
I have an interesting problem that I have yet to come accross that I can't change data structure on because it is an export from filemaker I am reformatting for another dept. anyway. I have a table...
6
by: saif.shakeel | last post by:
Hi, I have a dictionary which is something like this: id_lookup={ 16:'subfunction', 26:'dataId', 34:'parameterId', 39:'subfunction', 44:'dataPackageId', 45:'parameterId', 54:'subfunction',
4
by: sufian | last post by:
Below is the field where user enters his/her email address and the AJAX post request is sent to the server and the user sees the message: echo("<div id=\"message\" class=\"success\">Thank you! You...
8
by: smoky_flame via DotNetMonster.com | last post by:
hi, is it possible to take multiple values(int) seperated by commas as input from textbox in C# and draw a figure using those values. e.g. drawing a simple path using 1,2,3,4 values. --...
0
by: Maric Michaud | last post by:
Le Thursday 28 August 2008 03:43:16 norseman, vous avez écrit : Disctionaries are hash tables with a unique key and constant time lookup. What you want could be implemented as a complex data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.