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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Efficient way to count all users by first letter of last name 1

Status
Not open for further replies.

snowboardr

Programmer
Joined
Feb 22, 2002
Messages
1,401
Location
PH
What would be the most efficient way to count how many records there are for each last name of a user from A-Z

ie:

A: 30 users
B: 10 users
C: 22 users


Code:
select substring(clast, 1,1), count (clast) from customers group by substring(clast,1,1);

i tried this but i get an error saying:

#1305 - FUNCTION ttdb.count does not exist

Jason

[red]Army[/red] : [white]Combat Engineer[/white] : [blue]21B[/blue]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top