Re: Matching the first 3 letters of the field



Thx


On Jul 2, 11:20 am, "Allen Browne" <AllenBro...@xxxxxxxxxxxxxx> wrote:
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...@xxxxxxxxxxx> wrote in message

news:66d4f25d-5a29-4aca-9ed5-d8050e4a4d34@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

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"

.



Relevant Pages

  • Re: Matching the first 3 letters of the field
    ... FROM Table2 INNER JOIN Table1 ... Access will not be able to display this query graphically, ... and the field of the second table has a 6 digit number stored as text ...
    (comp.databases.ms-access)
  • Re: How do I combine 2 tables?
    ... Create a new query in design view. ... Select the fields from Table1 you wish to display. ... Select the fields from Table2 you wish to display. ...
    (microsoft.public.access.queries)
  • Need to display a field from another table in a form.
    ... I have a form based on a query from table1 and I also need to ... display a field from table2 which is not in the query. ... How do I do this as table2 is not related to table1 so I ...
    (microsoft.public.access.forms)
  • Re: SQL Statement
    ... USe the unmatched query wizard to display what you want. ... FROM Table1 LEFT JOIN Table2 ...
    (microsoft.public.access.queries)
  • Re: DB Result Wizard Error
    ... Also noted that one folder, which contains no information can't be deleted, ... >> For instance Equipment Serial Number, Equipment Model Number, Cost Accounting ... >> to display the new equipment information. ... >> is in the table was added to the query. ...
    (microsoft.public.frontpage.programming)