My table like
---------------
trtm t_date id_no certno1 certno2 certno3 certno4 certno5 certno6 certno7 certno8 certno9 certno10
TM 15/02/2002 A12 2158
TM 15/02/2010 A13 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190
TM 15/02/2010 A14 19138
-------------------
我需要id_no上和certno的数量从1到10如何使用SQL获得多列的计数
my query is
----------
select count(id_no) as total_id,count(CONCAT(certno1, certno2, certno3,certno4,certno5,certno6,certno7,certno8,certno9,certno10)) as certificate from table where trtm='TM'
----------
my output is:
---------
total_id certificate
3 3
-------------------------
,但我需要证明的计数其中的值有3,但我需要的是12
------------
output needs:
-----------
total_id certificate
3 12
-------------
我只得到total_id和certificate.so计数,请帮助我,如果有人知道。
见正常化 – Strawberry