1. SQL 数据库中如何统计指定数据的个数 高分急寻
select count(1) from table_name where 姓名1 = 'mary' +
select count(1) from table_name where 姓名2 = 'mary' +
select count(1) from table_name where 姓名3 = 'mary'+
select count(1) from table_name where 姓名4 = 'mary'+
select count(1) from table_name where 姓名5 = 'mary'
select count(*)
from (
select name1 from table_name
union all
select name2 from table_name
union all
select name3 from table_name
union all
select name4 from table_name
union all
select name5 from table_name
) t
where name1='mary'
笨而简单的方法,想一步完成,写个函数吧