SELECT修改
string str1 = "select count(*) from family where 姓名='" + name.Text + "'";
string str2 = "select count(*) from friend where 姓名='" + name.Text + "'";
string str3 = "select count(*) from classmate where 姓名='" + name.Text + "'";
string str4 = "select count(*) from workmate where 姓名='" + name.Text + "'";
string str5 = "select count(*) from other where 姓名='" + name.Text + "'
请问下这个语句怎样才能改成一个语句呢,我每张表里的内容都是一样的,现在对每张表里的姓名进行查询!不知道怎么能改成一个SELECT语句,请高手指点
[解决办法]
select 'family',count(*) from family where 姓名='" + name.Text + "'
union all
select 'friend',count(*) from friend where 姓名='" + name.Text + "'
union all
select 'classmate',count(*) from classmate where 姓名='" + name.Text + "'
union all
select 'workmate',count(*) from workmate where 姓名='" + name.Text + "'
union all
select 'other',count(*) from other where 姓名='" + name.Text + "'
可以的到数据集,体现各个表的查询姓名的个数