mysql - Sql query to Add non digit values of multiple columns into a single column and find the count -


i have 1 table 2 columns this

column1| column2      |      b    |    c   d    |    d 

the out put of query expect :

name | count    |  2  b   |  1  c   |  1  d   |  2 

it easy sum two(values) how concatenate nonvalues inside table.

the query tried:

select column1 name table union select column2 name table

i combined version of 2 columns how suuposed count(name) ?

this work perfectly..

select t.name, count(t.name) count  ( select `column1` name table  union  select `column2` name table ) t  group t.name 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -