Solved

MySQL transform pivot query

Posted on 2008-10-15
1
2,488 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

772 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