We help IT Professionals succeed at work.
Get Started

Counting the occurences an item shows up in multiple fields

349 Views
Last Modified: 2012-06-21
Hi. I have a table that is structured as the following:
TestRecord
User1
User2
User 3

so the data looks like this
Pass     UserA     UserB     UserC
Pass     UserB     UserC     Null
Fail        UserA     UserB     Null
Pass     UserA     UserB     Null
Pass     UserC     UserA     Null
Pass     UserB     UserA     UserC

Any ideas on how to write a sql statement that will count the number of occurences a specific user shows up in a record.
So....
UserA     5
User B    5
USer C    4

I am not even sure where to start or of this is possible.
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 10 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE