By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,611 Members | 1,661 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,611 IT Pros & Developers. It's quick & easy.

SQL joins and MID function

P: n/a
How can I join two tables on two keys, where one key need to have the
first character dropped.

tblA: fieldA1
tblB: fieldB1

This is kind of close (?):
LEFT JOIN tblB ON mid(fieldA1) = tblB.fieldB1
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I would make a query of the table first where you do right([field],
Len([field])-1) then link the query with the other table.

Better, use numbers to link as this is much faster and more efficient.

"John" <so*********@hotmail.com> wrote in message
news:90**************************@posting.google.c om...
How can I join two tables on two keys, where one key need to have the
first character dropped.

tblA: fieldA1
tblB: fieldB1

This is kind of close (?):
LEFT JOIN tblB ON mid(fieldA1) = tblB.fieldB1

---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.688 / Virus Database: 449 - Release Date: 18/05/2004
Nov 13 '05 #2

P: n/a
so*********@hotmail.com (John) wrote in message news:<90**************************@posting.google. com>...
How can I join two tables on two keys, where one key need to have the
first character dropped.

tblA: fieldA1
tblB: fieldB1

This is kind of close (?):
LEFT JOIN tblB ON mid(fieldA1) = tblB.fieldB1


SELECT *
FROM
tblA
LEFT JOIN
tblB
ON Mid(tblA.fieldA1,2) = tblB.fieldB1

'===============
' John Mishefske
'===============
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.