Rows as columns in MYSQL

My table, t, has the following format:

Rows as columns in MYSQL

I would like to transform this table into:

Rows as columns in MYSQL

The COUNT_XXXXX columns are determined by counting the number of rows where CLICKSKEY is not NULL organised by SUBJECT_TYPE. The COUNT_CLICKED column counts the number of rows where CLICKSKEY is not NULL independent of SUBJECT_TYPE.

Could anybody help?

Thank you, Phil,

Replay

Category: mysql Time: 2016-07-29 Views: 4
Tags: mysql pivot

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.134 (s). 12 q(s)