SQL - Grouping by part of a text field.

NKDietrich

Supreme [H]ardness
Joined
Jul 25, 2004
Messages
5,442
So, I'm taking this SQL class. I've got a bunch of account numbers and various other columns in a table. As part of the project, I need to write a query to group a few of the other columns by the first three digits of the account number. I can't figure out how to pull the first three digits, other than normalizing the database to put those three digits in their own column (which is outside of the scope of what I'm being asked to do.)

I've tried combing through my text for the class and I haven't found anything on how to do this. Writing the query and grouping is easy as can be, but getting those first three digits, I'm clearly missing something.

Any help would be appreciated.
 
Back
Top