Avatar of goodk
goodk
Flag for United States of America asked on

select (count(job) + job) from AceData group by job ??

select (count(job) + job)  from AceData  group by job

using ms sql server

the above not working

want to show,

25 myJob
30 otherjob
01 badjob
SQL

Avatar of undefined
Last Comment
goodk

8/22/2022 - Mon
SOLUTION
Pratima

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
goodk

ASKER
I've requested that this question be deleted for the following reason:

resolved used str() to convert
SOLUTION
RehanYousaf

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
awking00

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
goodk

ASKER
I tried this, should this be ok?  The results looks fine
Select (type +' ('+ ltrim(str(count(type))) +')' ) as xtest from AceData group by type
goodk

ASKER
thanks
Your help has saved me hundreds of hours of internet surfing.
fblack61
RehanYousaf

Yes that will work but why use to functions when you can get away with one

In programming trick is to make things simple not complicated

Select (type +' ('+ convert(varchar,count(type)) +')' )

Open in new window

goodk

ASKER
thanks