SQL Query Alias Names

I am runningteh following query below and I ma getting the correct results.

I want to do another task, add "ml" to every MLUserName returened.

example query returns Alan, i want it to return mlAlan

Thansk in advance
SELECT     TOP (100) PERCENT CountyID, ROC AS mlUserName, COUNT(ROCID) AS CountOfROCID
FROM         dbo.query11
GROUP BY CountyID, ROC
ORDER BY mlUserName

Open in new window

BrogrimInformation Systems Development ManagerAsked:
Who is Participating?
 
chapmandewCommented:
next time, include that as part of your original question.

--if it exists
insert into tblCounty_mlUserName(countryid, username, count)
SELECT     CountyID, 'ml' + ROC AS mlUserName, COUNT(ROCID) AS CountOfROCID
FROM         dbo.query11
GROUP BY CountyID, ROC

--if it doesn't
SELECT     CountyID, 'ml' + ROC AS mlUserName, COUNT(ROCID) AS CountOfROCID
INTO tblCounty_mlUserName
FROM         dbo.query11
GROUP BY CountyID, ROC
0
 
chapmandewCommented:
SELECT     TOP (100) PERCENT CountyID, 'ml' + ROC AS mlUserName, COUNT(ROCID) AS CountOfROCID
FROM         dbo.query11
GROUP BY CountyID, ROC
ORDER BY mlUserName
0
 
Patrick MatthewsCommented:
SELECT     TOP (100) PERCENT CountyID, 'ml' + ROC AS mlUserName, COUNT(ROCID) AS CountOfROCID
FROM         dbo.query11
GROUP BY CountyID, ROC
ORDER BY mlUserName
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Patrick MatthewsCommented:
too slow :)
0
 
BrogrimInformation Systems Development ManagerAuthor Commented:
To get teh points how to put the results into a table called tblCounty_mlUserName.

Nearly there
0
 
BrogrimInformation Systems Development ManagerAuthor Commented:
a bit moody but very helpfull
0
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.

All Courses

From novice to tech pro — start learning today.