Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
SQL QUESTION (SQL SERVER) : nb of occurences in a list
I have a table of personns (personnID, name) and a tables of commands (CommandRef, PersonnID), several commands being associated with one personn thru the PersonnID column.
So to see my commands and personns, I do :
select name, commandRef from personns left join commands on personns.personnID = commands.PersonnID
So I get something like :
I need to have the information that a name as several commands, so I need the listing to have a third column like :
Smith Ref-1 3
Smith Ref-2 3
Smith Ref-3 3
Taylor Ref-4 1
Johns Ref-5 1
Is there a "direct" way (without using a UDF function that counts because of performance problem) to get this third column in SQL ?
Any help greatly appreciated
Microsoft SQL Server
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Thank you, this is perfect :)
Your help has saved me hundreds of hours of internet surfing.
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent