Solved

MySQL transform pivot query

Posted on 2008-10-15
1
2,485 Views
Last Modified: 2012-05-05
This is my table...
INTERVENTION      |  Proj      | Proj2            | Proj 3|
200             |  2      | NULL       | NULL  |
200             |  NULL      | 3       | NULL  |
200             |  NULL      | NULL       | 4         |
203             |  5      | NULL       | NULL  |
203             |  NULL      | 9       | NULL  |
203             |  NULL      | NULL       | 2          |

What query do run to get this?

INTERVENTION      |Proj      | Proj2 |           Proj 3          |
200            |2      | 3      | 4      |
203            |5      | 9      | 2      |
0
Comment
Question by:hbojorquezgeek
1 Comment
 
LVL 23

Accepted Solution

by:
Tiggerito earned 500 total points
ID: 22729999
Looks like

select INTERVENTION, sum(Proj), sum(Proj2), sum(Proj3) from myTable  group by INTERVENTION;
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now