How to count the common column rows in the table for each column and row…..

15 pts.
Tags:
SQL
SQL 2008
SQL Column Headings
SQL Server 2008
I have a table and that table have columns like d1,d2,d3,d4.......

d1      d2    d3    d4 --------------------------- 200   300   100  300 100   200   101  101 300   ---    300  200

how can i display the output like below...  for each row....

ColumnD1 Count 200    3 100     3 300     4

Please help me on this,................i am new to the SQL...

 



Software/Hardware used:
SQL Server 2008

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    I think you will have to explain more clearly your requirement. You should specify what of the above values are column names and what are the actual values stored in each row. Also, you might want to explain (with words) what is the logic behind the results you want to get.
    69,065 pointsBadges:
    report
  • Paanduranga
    I have a table and that table have columns like d1,d2,d3,d4....... d1 d2 d3 d4 --------------------------- 200 300 100 300 100 200 101 101 300 --- 300 200 I need the out put like below... for each row.... Column_Name Count 200 3 100 1 300 4 Here we have 200 that is how many times are coming in all the columns as well rows . as per the above data 200 has come 3 times and 100 comes 1 time and 300 comes 4 times .......
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following