need to Left Join using only first 3 characters in a field

Randy

Registered User.
Local time
, 22:50
Joined
Aug 2, 2002
Messages
94
I have two tables
tblcurrency > group1 > 3 characters long i.e. 123

and

tbltdataseg > account > 12 characters long i.e. 123456789012

I need to left join tbltdataseg to tblcurrency

I tried this
SELECT tbltdataseg.ENTITY, tbltdataseg.ENTITYX, tbltdataseg.ACCOUNT, tbltdataseg.AMOUNT,tblcurrency.currency
FROM tbltdataseg LEFT JOIN (LEFT(tbltdataseg.ACCOUNT,3) = tblcurrency.group1);

what am I doing wrong?
 
Code:
FROM tbltdataseg 
LEFT JOIN tblcurrency
ON LEFT(tbltdataseg.ACCOUNT,3) = tblcurrency.group1;
 
1. You're not storing discrete pieces of data discretely. If the first 3 digits of your field is a unit of data itself, then it should be stored seperately from the rest.

2. You haven't stated what table you are joining.

3. You have no ON.

A LEFT JOIN looks like this:

LEFT JOIN TableLeftJoin ON TableFrom.Field = TableLeftJoin.Field
 
I cannot believe I missed ON. I could not see the tree for the forest. :-) sorry to post such a dumb question, but thanks that was all it was. If I knew how to insert the head hitting icon I would
 

Users who are viewing this thread

Back
Top Bottom