Solved

Cannot join memo field

Posted on 2013-12-16
8
476 Views
Last Modified: 2013-12-19
Hi,

I have SQL code and im trying to join memo fields


Is someone able to add the line of SQL

Where Left([INPUT D2 DATA].[Customer Type], 255) = Left([Calculation D2].[Client Type], 255

Im new to SQL so keep getting the syntax wrong.

Many thanks

SELECT INPUT_D2_all.ID, INPUT_D2_all.ClientID, INPUT_D2_all.[Customer Type Family], INPUT_D2_all.[Customer Type], INPUT_D2_all.LoB, INPUT_D2_all.Segment, INPUT_D2_all.[Business Type], INPUT_D2_all.[Employment Status], INPUT_D2_all.[Key controller flag], INPUT_D2_all.[Country of Incorp/ Registration / Trust Est], INPUT_D2_all.[Country of Primary Operation], INPUT_D2_all.[Country of Business Focus], INPUT_D2_all.[Country of SoW], INPUT_D2_all.[Country of Nationality / Citizenship], INPUT_D2_all.[Country of Perm Residence], INPUT_D2_all.[Country of Government], INPUT_D2_all.[Legal Entity Structure], INPUT_D2_all.[Product Risk], INPUT_D2_all.[Trade Flag], INPUT_D2_all.[PCM Flag], INPUT_D2_all.[Safe Deposit Product Flag], INPUT_D2_all.[$ Cash transactions - m1], INPUT_D2_all.[$ Cash transactions - m2], INPUT_D2_all.[$ Cash transactions - m3], INPUT_D2_all.[$ Cash transactions - m4], INPUT_D2_all.[$ Cash transactions - m5], INPUT_D2_all.[$ Cash transactions - m6], INPUT_D2_all.[$ Cash transactions - m7], INPUT_D2_all.[$ Cash transactions - m8], INPUT_D2_all.[$ Cash transactions - m9], INPUT_D2_all.[$ Cash transactions - m10], INPUT_D2_all.[$ Cash transactions - m11], INPUT_D2_all.[$ Cash transactions - m12], INPUT_D2_all.[# Cash transactions - m1], INPUT_D2_all.[# Cash transactions - m2], INPUT_D2_all.[# Cash transactions - m3], INPUT_D2_all.[# Cash transactions - m4], INPUT_D2_all.[# Cash transactions - m5], INPUT_D2_all.[# Cash transactions - m6], INPUT_D2_all.[# Cash transactions - m7], INPUT_D2_all.[# Cash transactions - m8], INPUT_D2_all.[# Cash transactions - m9], INPUT_D2_all.[# Cash transactions - m10], INPUT_D2_all.[# Cash transactions - m11], INPUT_D2_all.[# Cash transactions - m12], INPUT_D2_all.[$ Cross-border wires m1], INPUT_D2_all.[$ Cross-border wires m2], INPUT_D2_all.[$ Cross-border wires m3], INPUT_D2_all.[$ Cross-border wires m4], INPUT_D2_all.[$ Cross-border wires m5], INPUT_D2_all.[$ Cross-border wires m6], INPUT_D2_all.[$ Cross-border wires m7], INPUT_D2_all.[$ Cross-border wires m8], INPUT_D2_all.[$ Cross-border wires m9], INPUT_D2_all.[$ Cross-border wires m10], INPUT_D2_all.[$ Cross-border wires m11], INPUT_D2_all.[$ Cross-border wires m12], INPUT_D2_all.[# Cross-border wires - m1], INPUT_D2_all.[# Cross-border wires - m2], INPUT_D2_all.[# Cross-border wires - m3], INPUT_D2_all.[# Cross-border wires - m4], INPUT_D2_all.[# Cross-border wires - m5], INPUT_D2_all.[# Cross-border wires - m6], INPUT_D2_all.[# Cross-border wires - m7], INPUT_D2_all.[# Cross-border wires - m8], INPUT_D2_all.[# Cross-border wires - m9], INPUT_D2_all.[# Cross-border wires - m10], INPUT_D2_all.[# Cross-border wires - m11], INPUT_D2_all.[# Cross-border wires - m12], INPUT_D2_all.[$ PCM wires - m1], INPUT_D2_all.[$ PCM wires - m2], INPUT_D2_all.[$ PCM wires - m3], INPUT_D2_all.[$ PCM wires - m4], INPUT_D2_all.[$ PCM wires - m5], INPUT_D2_all.[$ PCM wires - m6], INPUT_D2_all.[$ PCM wires - m7], INPUT_D2_all.[$ PCM wires - m8], INPUT_D2_all.[$ PCM wires - m9], INPUT_D2_all.[$ PCM wires - m10], INPUT_D2_all.[$ PCM wires - m11], INPUT_D2_all.[$ PCM wires - m12], INPUT_D2_all.[# PCM wires - m1], INPUT_D2_all.[# PCM wires - m2], INPUT_D2_all.[# PCM wires - m3], INPUT_D2_all.[# PCM wires - m4], INPUT_D2_all.[# PCM wires - m5], INPUT_D2_all.[# PCM wires - m6], INPUT_D2_all.[# PCM wires - m7], INPUT_D2_all.[# PCM wires - m8], INPUT_D2_all.[# PCM wires - m9], INPUT_D2_all.[# PCM wires - m10], INPUT_D2_all.[# PCM wires - m11], INPUT_D2_all.[# PCM wires - m12], INPUT_D2_all.[$ wires to high risk countries m1], INPUT_D2_all.[$ wires to high risk countries m2], INPUT_D2_all.[$ wires to high risk countries m3], INPUT_D2_all.[$ wires to high risk countries m4], INPUT_D2_all.[$ wires to high risk countries m5], INPUT_D2_all.[$ wires to high risk countries m6], INPUT_D2_all.[$ wires to high risk countries m7], INPUT_D2_all.[$ wires to high risk countries m8], INPUT_D2_all.[$ wires to high risk countries m9], INPUT_D2_all.[$ wires to high risk countries m10], INPUT_D2_all.[$ wires to high risk countries m11], INPUT_D2_all.[$ wires to high risk countries m12], INPUT_D2_all.[# wires to high risk countries m1], INPUT_D2_all.[# wires to high risk countries m2], INPUT_D2_all.[# wires to high risk countries m3], INPUT_D2_all.[# wires to high risk countries m4], INPUT_D2_all.[# wires to high risk countries m5], INPUT_D2_all.[# wires to high risk countries m6], INPUT_D2_all.[# wires to high risk countries m7], INPUT_D2_all.[# wires to high risk countries m8], INPUT_D2_all.[# wires to high risk countries m9], INPUT_D2_all.[# wires to high risk countries m10], INPUT_D2_all.[# wires to high risk countries m11], INPUT_D2_all.[# wires to high risk countries m12], INPUT_D2_all.[Turnover (GPB HNAH only)], INPUT_D2_all.[SCC flag], INPUT_D2_all.[SCC reason], INPUT_D2_all.[Previous Risk Rating], INPUT_D2_all.[Previous Country Risk Factor Rating], INPUT_D2_all.[Previous Business Type Risk Factor Rating], INPUT_D2_all.[Previous Legal Entity Risk Factor rating], INPUT_D2_all.[Previous Product Risk Factor Rating], INPUT_D2_all.[Assumption flag], INPUT_D2_all.LOB1, INPUT_D2_all.Country, INPUT_D2_all.[Cash Only], INPUT_D2_all.[Cash/Xborder], INPUT_D2_all.PRR, Calculation_D2_all.[Overal RAG]
FROM Calculation_D2_all INNER JOIN INPUT_D2_all ON Calculation_D2_all.[Client Type] = INPUT_D2_all.ClientID
WHERE (((INPUT_D2_all.LOB1)="GPB"));
0
Comment
Question by:Seamus2626
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 167 total points
Comment Utility
The simplest, I guess, would be to combine the join into the where clause:

FROM
    INPUT_D2_all,
    Calculation_D2_all
Where
    [INPUT_D2_all].[ClientID] = [Calculation_D2_all].[Client Type]
    And
    Left([INPUT D2 DATA].[Customer Type], 255) = Left([Calculation D2].[Client Type], 255)

/gustav
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 167 total points
Comment Utility
Why is Customer_Type a Memo field?  Just seems unusual (I asked this in one of your other questions as well).  From the field name, it seems like a text field would be a better choice... versus something like 'Notes' which may receive a lot of user input.

If you could change the field to TEXT (even with a long length such as 500), you would eliminate this "can't join on memo" issue.
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
Plus, that Left(FieldName,255) in the JOIN seems like a hack.  

If the field can contain more than 255 characters, you would run into problems with the JOIN if any differences occurred after the first 255 characters,  

If the field contains 255 characters or LESS, why not cleanly eliminate the problem by defining it as Text instead of Memo?
0
 

Author Comment

by:Seamus2626
Comment Utility
When i try and change data type, i get the error "Microsoft Access cant change the data type"

There isnt enough disk space or memory
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 61

Expert Comment

by:mbizup
Comment Utility
Have you tried compact/repairing the database?
0
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
It is a hack but it works as you can't join memo fields. No repair is needed.

It doesn't matter if a memo holds more than 255 chars but, of course, the first the first 255 chars should be unique if any memo field is considered unique.

/gustav
0
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 166 total points
Comment Utility
Just to kick in a comment or two, I can't think of any logical reason why you'd want to join on a memo field, which means more then likely, your database design needs some re-work.

A word to the wise: I'd stop and do that now before you continue on as this will just be the start of many issues.

Access (and other relational products) were desinged to work with properly structured databases.   If your database is not, then it's not going to work well, and maybe not even at all.

For example, while you might be able to hack a join on the first 255 characters, the CPU/memory requirements will be intensive.   Performance will be dismal and you may find it no longer works even with ten or twenty thousand records.

Jim.
0
 

Author Closing Comment

by:Seamus2626
Comment Utility
Rebuild is needed!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now