an expression

L

Lana

I have 2 tables that I am trying to join. The tables are X and Y for now. In
X I have the query asking for the number that I want to be pulled and it
works. Now I am trying to do an expression in Y in the field that corresponds
to the value I am pulling up. Example in X I am pulling 3.250 this shows all
of my records. In table Y I would like 3.250 to pull only records that
contain 3.250 in it like...3.250 x 2.625 or 2.875 x 3.250 or even 3.250 x
3.250. I cannot seem to get the expression correct. My query comes up with
blank results.

Thank you for your input.
 
T

Tom van Stiphout

On Wed, 18 Feb 2009 04:51:00 -0800, Lana

Join on the field in X with the expression on it.
The inner join will then automatically only select those records in Y
with that value in the joined field.

-Tom.
Microsoft Access MVP
 
L

Lana

I tried that; it lists all of the parts, but not the ones that only contain
the number I am asking for.
 
J

John Spencer

The SQL statement for your query would look like the following.

SELECT X.*, Y.*
FROM X INNER JOIN Y
ON Y.SomeField LIKE "*" & X.SomeField & "*"

Post back if you cannot build a query in SQL, but can only use the query
grid.

Alternate SQL which may be considerably slower

SELECT X.*, Y.*
FROM X, Y
WHERE Y.SomeField LIKE "*" & X.SomeField & "*"

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
T

Tom van Stiphout

On Wed, 18 Feb 2009 06:14:10 -0800, Lana

Then there is something that you're not telling us, or I'm
misunderstanding, because what I said is how SQL works.

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top