How do I use the value returned by a query in the same procedure? (sorry for noob-ism)
I'm trying to get a number of users with an initial beginning with whatever as a list - i.e. A(4) B(2) c(5) etc
SELECT DISTINCT LEFT(last_name, 1) AS initial
FROM users
ORDER BY initial
How do I then go on to ask:
select COUNT(*) as NumTeam
from users
where last_name like initial + '%'