ACCESS SQL join on data type int to text

Hello All:
In teh sql below, the data type for b.branch is text and the data type for f.office is number. I tried to run the statement below and I get data type mismatch. I am sure the "and Clng(b.branch) = f.office" portion is the trouble: when I remove it the statement runs.


select f.fa,  f.name,f.empid, f.office, b.description,f.revenue
from [Fiscal 2008] f, [Product Code Table Sept 2008] p, [September 2008 Branch Hierarchy] b
where  f.[product code] = p.[prod code]
and Clng(b.branch) = f.office
and f.empid <> ""
and f.empid not in ("99999","99970")
and p.[lvl 2] in (1,4,2)


Any suggestions?
StacyDAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nathan RileyFounderCommented:
Change your select to:



select f.fa,  f.name,f.empid, cast(f.office as varchar), b.description,f.revenue

Open in new window

0
rockiroadsCommented:
Cant see why that fails. Have you tried using VAL?

and val(b.branch) = f.office

what type of number is office defined as. Maybe need to use another number conversion func.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
StacyDAuthor Commented:
I'm going to try both as soon as my database finishes compacting.
0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Nathan RileyFounderCommented:
any luck?
0
StacyDAuthor Commented:
neither one worked - I ended up changing the data type.
0
StacyDAuthor Commented:
It pointed me to use clng and cstr.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.