473,396 Members | 1,995 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.

String Intersection

Hello,

I am new to SQL and currently using Access 2003 and need a little help
on the following.

I have two queries each contains one column formed with a string that
is very similar (only variying by few characters) to the other column
as follows:

QUERY1 QUERY2
Column1 Column2

The new Query should make a String Intersection: Column1 with Column2
on to a new column.

Help is deeply appreciated.

Have a great day,

Sebastian Cohen S
Nov 13 '05 #1
4 3335
I don't know if I undersand your definition of Intersection?

if by Intersection you mean...
That Column2 (match word)
T 1000 1
h 0100 1
i 0000 0
s 0000 0
1100
^
|- Column1 (known word)

.... what would column three contain "Th" for matched characters or
"is" for
un-matched characters? Now that I re-read this thing, I must be
barking up the wrong tree, cause I don't see the value in returning
either matched or un-match characters (although because I don't see
the value, doesn't mean there isn't any).

It seems more info is needed.

sc****@cable.net.co (Sebastian Cohen S) wrote in message news:<da**************************@posting.google. com>...
Hello,

I am new to SQL and currently using Access 2003 and need a little help
on the following.

I have two queries each contains one column formed with a string that
is very similar (only variying by few characters) to the other column
as follows:

QUERY1 QUERY2
Column1 Column2

The new Query should make a String Intersection: Column1 with Column2
on to a new column.

Help is deeply appreciated.

Have a great day,

Sebastian Cohen S

Nov 13 '05 #2
Hello Tom,

Thank you for your patience and reply. I mean by intersection of the
two columns by:

column 1 text: this
column 2 text: this(1)
intersection leads to the text: this

My final objective is to delete extra characters of very similar data
that is in two columns.

Have a great day,

Allow me to Thank You again,

Sebastian Cohen S

tw*@gate.net (Tom Warren) wrote in message news:<f4**************************@posting.google. com>...
I don't know if I undersand your definition of Intersection?

if by Intersection you mean...
That Column2 (match word)
T 1000 1
h 0100 1
i 0000 0
s 0000 0
1100
^
|- Column1 (known word)

... what would column three contain "Th" for matched characters or
"is" for
un-matched characters? Now that I re-read this thing, I must be
barking up the wrong tree, cause I don't see the value in returning
either matched or un-match characters (although because I don't see
the value, doesn't mean there isn't any).

It seems more info is needed.

sc****@cable.net.co (Sebastian Cohen S) wrote in message news:<da**************************@posting.google. com>...
Hello,

I am new to SQL and currently using Access 2003 and need a little help
on the following.

I have two queries each contains one column formed with a string that
is very similar (only variying by few characters) to the other column
as follows:

QUERY1 QUERY2
Column1 Column2

The new Query should make a String Intersection: Column1 with Column2
on to a new column.

Help is deeply appreciated.

Have a great day,

Sebastian Cohen S

Nov 13 '05 #3
My question in terms relative to this example was, how do we know that
"this(1)" in column 2 contains characters that need to be deleted, and
NOT that "this" in column 1 is missing characters? Is column 1 a known
value? Are all words in column 2 truncated to the shortest possible
word in column 1? How are these two columns joined, a common column
not defined in the example?

Sorry to answer your Qs with more Qs but...
Tom

sc****@cable.net.co (Sebastian Cohen S) wrote in message news:<da**************************@posting.google. com>...
Hello Tom,

Thank you for your patience and reply. I mean by intersection of the
two columns by:

column 1 text: this
column 2 text: this(1)
intersection leads to the text: this

My final objective is to delete extra characters of very similar data
that is in two columns.

Have a great day,

Allow me to Thank You again,

Sebastian Cohen S

tw*@gate.net (Tom Warren) wrote in message news:<f4**************************@posting.google. com>...
I don't know if I undersand your definition of Intersection?

if by Intersection you mean...
That Column2 (match word)
T 1000 1
h 0100 1
i 0000 0
s 0000 0
1100
^
|- Column1 (known word)

... what would column three contain "Th" for matched characters or
"is" for
un-matched characters? Now that I re-read this thing, I must be
barking up the wrong tree, cause I don't see the value in returning
either matched or un-match characters (although because I don't see
the value, doesn't mean there isn't any).

It seems more info is needed.

sc****@cable.net.co (Sebastian Cohen S) wrote in message news:<da**************************@posting.google. com>...
Hello,

I am new to SQL and currently using Access 2003 and need a little help
on the following.

I have two queries each contains one column formed with a string that
is very similar (only variying by few characters) to the other column
as follows:

QUERY1 QUERY2
Column1 Column2

The new Query should make a String Intersection: Column1 with Column2
on to a new column.

Help is deeply appreciated.

Have a great day,

Sebastian Cohen S

Nov 13 '05 #4
Sebastian Cohen S wrote:
Hello,

I am new to SQL and currently using Access 2003 and need a little help
on the following.

I have two queries each contains one column formed with a string that
is very similar (only variying by few characters) to the other column
as follows:

QUERY1 QUERY2
Column1 Column2

The new Query should make a String Intersection: Column1 with Column2
on to a new column.

Help is deeply appreciated.

Have a great day,

Sebastian Cohen S


After reading your thread between you and Tom, this is a concept only.
And MAY work only if Query2 has an autoid or some sort of primary key.

You would need to create a couple of more queries. And write a function.

Create a new query with QUery1. Create an expression that passes the
column to compare to a function. Ex:
Query2Keys : CheckQuery2([Column1])
This would pass the value of column1 to the function.

'function aircode
Function CheckQuery2(strVal As String) As Variant
Dim strSQL As STring
Dim rst As REcordset
strSQL = "Select Q2.ID From Q2 " & _
"WHere Q2.Column2 Like '" & strVal & "*'"
Set rst = currentdb.openrecordset(strSQL,dbopensnapshot)
Do while not rst.eof
CheckQuery2 = CheckQuery2 & _
"'" & rst!ID & "',"
'option 2 is to insert a new record here on the id
'and use this to link to Q2 later
rst.movenext
Loop

'remove ending comma
If CheckQuery2 > "" THen
CheckQuery2 = Left(CheckQuery2,Len(CheckQuery2)-1)
ENd Function

Now you have the list of IDs from Q2 that have a similar string
contained in Q1

Now create another query on Q2 where the id is contained in the the
above query.

I'm not sure how you'll merge the two queries together. You may get a
cartesian join. Option 2. I suppose you could create another table and
instead of passing back the string, create a record in the table for
each q2 id that matches. It would contain the value passed to the
function (Q1 value), and the Q2 ID. Then link Q2 to this new table and
you can display the value from Q1. Or pass to the function also Q1's ID
and store that ID as well as Q2's id. THis way you have a bridge
between both queries. A bit confusing but you should be able to get the
gist of this message.


Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Christos TZOTZIOY Georgiou | last post by:
This is a subject that comes up fairly often. Last night, I had the following idea, for which I would like feedback from you. This could be implemented as a function in codecs.py (let's call it...
5
by: Antoine Logean | last post by:
Hi, What is the easiest way to get the intersection of two strings in python (a kind a "and" operator) ? ex: string_1 =...
17
by: Gordon Williams | last post by:
Hi, I have to lists that I need to find the common numbers (2nd rounded to nearest integral) and I am wondering if there is a more efficient way of doing it. >>> a= >>> b= >>> ...
3
by: Alain Frisch | last post by:
Hello, The following rule in the XML Schema spec, section "Schema Component Constraint: Attribute Wildcard Intersection" seems strange to me: ======================================= 3 If...
6
by: kimos | last post by:
hi all, how to calculate the intersection of 2 rectangle a rectangle is the following: Rectangle makeRectangle (Point lowerLeft, Point upperRight) { Rectangle r;
9
by: Jim Lewis | last post by:
Anyone have experience with string pattern matching? I need a fast way to match variables to strings. Example: string - variables ============ abcaaab - xyz abca - xy eeabcac - vxw x...
2
by: mkppk | last post by:
I have kind of strange change I'd like to make to the sets.Set() intersection() method.. Normally, intersection would return items in both s1 and s2 like with something like this: ...
12
by: bahadir.balban | last post by:
Hi, How do you check string intersection? There doesn't seem to be a library function to do that, e.g: +#include <linux/string.h> + +/* AND'ing two strings (checks intersection) */ +static...
1
by: kenninho119 | last post by:
Implement a function strIntersection(str1, str2) that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. The letters should be in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.