MS-ACCESS Select substring

Hello EVeryone,

I'm working on a a critical report and I was forced to used MS-ACCESS over ORACLE.  Now I'm stuck with a basic select statement.  Anyway, to make a long story short, I want to select the first two digits of a column in access -- how can I do this.  For eg, the column always contains a 4 character field like 4443 (this is not a number).  All I want to do is select the first two characters, in this case '44'.  Any ideas?    Please this is an urgent call -- I've attached 200 points to this question.  Thanks for your time and help!!

ITorBust
itorbustAsked:
Who is Participating?
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.

rherguthCommented:
The expression you're looking for is LEFT()

An example:
SELECT Left(FirstName, 2) as left2 FROM Contacts;

To do this through the interface, you could just click new query in Access and then select SQL View from the View menu and type in your SQL.   If you then switch back to design view, you'll see how to set the expression with the GUI.  I suspect you're more comfortable just typing the SQL anyway.

-- Bob
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
namasi_navaretnamCommented:
Access equalent of substring is MID or MID$ function.

Select Mid$('Namasi, 2, 2)  //returns "am"
0
arnaudduplessyCommented:
This is for first two characters from the left:

SELECT FieldName
FROM TableName
WHERE Left([FieldName],2)="Criteria";
---------------------------------------------------
This is for mid three characters starting a the second character from the left:
SELECT FieldName
FROM TableName
WHERE  Mid([FieldName],2,3)="Criteria";
----------------------------------------------------
This is for first two characters from the right:
SELECT FieldName
FROM TableName
WHERE Right([FieldName],2)="Criteria";

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
Databases

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.