Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count last 4 letters of field 1

Status
Not open for further replies.

Taff82

Programmer
Feb 11, 2004
43
GB
Hi All,

Not sure at all if this is possible, but here goes.

I have a field which is made up of letters. The field is 8 letters long and I was wondering if it is possible in a query to count the last four letters of the field in the table and see how many of them there are.

For example: -

Field
AAAA
AAAA
AAAA
AAAB
AAAB
AAAB
AAAD
AAAD

If I were to count them it would look something like this: -

Field Count
AAAA 3
AAAB 3
AAAD 2

Not sure if that is clear enough.

Any help is greatly appreciated.

Many Thanks,
Anthony.
 
Hi
SELECT Right([letterfield],4) AS Test, Count(Table1.Letterfield) AS CountOfLetterfield
FROM Table1
GROUP BY Right([letterfield],4);
 
Hi SuicedEd,

Exactly what I was after.

Thanks

Anthony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top