Unmatched Query: Memo Fields

B

Bernie

Is there anyway to compare memo fields using queries? I
can create Unmatched Queries to compare text and quantity
fields; but I can't perform the same type of function on
memo fields.
 
J

John Spencer (MVP)

It can be done. One method is as follows (WARNING!! THIS IS SLOW).

SELECT YourTable.*
FROM YourTable
WHERE YourTable.PrimaryKey Not IN
(SELECT DISTINCTROW YourTable.PrimaryKey
FROM YourTable, YourOtherTable
WHERE YourTable.YourMemo = YourOtherTable.YourMemo)

Another method would depend on whether or not it is sufficient to match on the
first 255 characters of the memo fields. In that case, you could use something like.

SELECT YourTable.*
FROM YourTable LEFT JOIN YourOtherTable
ON LEFT(YourTable.YourMemo,255) = LEFT(YourOtherTable.YourMemo,255)
WHERE YourOtherTable.YourMemo is Null

Note that the above query cannot be constructed in the query grid (the join
clause precludes this)

You can extend the number of characters used in the join by using the mid
function and multiple criteria for the join.

SELECT YourTable.*
FROM YourTable LEFT JOIN YourOtherTable
ON Mid(YourTable.YourMemo,1,250) = Mid(YourOtherTable.YourMemo,1,250)
AND Mid(YourTable.YourMemo,251,250) = Mid(YourOtherTable.YourMemo,251,250)
WHERE YourOtherTable.YourMemo is Null
 

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