473,466 Members | 1,511 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Matching the first 3 letters of the field

I have 2 tables with 1 field each
the filed of the fist table has a 3 digit number stored as text
and the field of the second table has a 6 digit number stored as text

I'd like to select each 6 digit number where the first 3 digits match
the field in the first table

I'm not sure If I can use the "LIKE"
Jul 2 '08 #1
2 5097
You can use LIKE in the FROM clause, like this:

SELECT Table1.*
FROM Table2 INNER JOIN Table1
ON Table2.[SomeField] Like Table1.[SomeField] & "*"

Access will not be able to display this query graphically (i.e. it's SQL
View only), and results will be read-only.

An alternative approach (probably more efficient) would be to create a query
that uses integer division to lose the least-significant 3 digits from table
2:
SELECT [SomeField] \ 1000 AS MyAlias
FROM Table2;

You could then use that query as in input table, and join it to Table1. This
will display graphically.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"nofear" <eu*******@hotmail.comwrote in message
news:66**********************************@k37g2000 hsf.googlegroups.com...
>I have 2 tables with 1 field each
the filed of the fist table has a 3 digit number stored as text
and the field of the second table has a 6 digit number stored as text

I'd like to select each 6 digit number where the first 3 digits match
the field in the first table

I'm not sure If I can use the "LIKE"
Jul 2 '08 #2
Thx
On Jul 2, 11:20*am, "Allen Browne" <AllenBro...@SeeSig.Invalidwrote:
You can use LIKE in the FROM clause, like this:

SELECT Table1.*
FROM Table2 INNER JOIN Table1
* * ON Table2.[SomeField] Like Table1.[SomeField] & "*"

Access will not be able to display this query graphically (i.e. it's SQL
View only), and results will be read-only.

An alternative approach (probably more efficient) would be to create a query
that uses integer division to lose the least-significant 3 digits from table
2:
* * SELECT [SomeField] \ 1000 AS MyAlias
* * FROM Table2;

You could then use that query as in input table, and join it to Table1. This
will display graphically.

--
Allen Browne - Microsoft MVP. *Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"nofear" <euroli...@hotmail.comwrote in message

news:66**********************************@k37g2000 hsf.googlegroups.com...
I have 2 tables with 1 field each
the filed of the fist table has a 3 digit number stored as text
and the field of the second table has a 6 digit number stored as text
I'd like to select each 6 digit number where the first 3 digits match
the field in the first table
I'm not sure If I can use the "LIKE"
Jul 2 '08 #3

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

Similar topics

1
by: Dariusz | last post by:
Despite looking at a number of tutorials in books and online examples on pattern matching - I can't quite get my head around it to work... so need some help. What I have now is a variable that...
5
by: Abby Lee | last post by:
I ask the user to enter a time in the formatio 12:30 PM. onChange I send the string to this function. I'm using alert boxes to test it...and am always getting the "Does not work" alert box. What am...
2
by: Peter McKeown | last post by:
I want to write letters to people in my database. I have a field Surname and a field FirstNames. How do I get the first letters of each word in FirstNames? For example: Surname "Bloggs" ...
7
by: AA Arens | last post by:
I want to fill in data in the fields and the first caracter is now automatic capitalized, however, I do not want this as abbiviations must be fully in capitals. How to get it? Bart Acc 2003.
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...
3
newnewbie
by: newnewbie | last post by:
I need help with a query where I am trying to match and display the value (First 18 characters of it) in one table that matches the first 18 characters of the field value in another table. Tables are...
4
natalie99
by: natalie99 | last post by:
Hi All This may be a very basic question, please bare with me I am learning! I have two sets of data, one is the baseline of a Billing Inventory, the other is a seperate data set from the Live...
2
by: sajancr | last post by:
dear sir, i need help in perl program where i want to search a string from paragraph and to convert all the letters in para to X except that string... in this program i have used string matching...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.