drop table if exists table1;
create table table1(
u_id int,
u_value varchar(100)
);
drop table if exists table2;
create table table2(
p_value varchar(100)
);insert into table1( u_id, u_value)
select 1, '135,178,129,135,241' union ALL
select 2, '120,121,137' union all
select 3, '156,131,134,123,134' union all
select 4, '100,200';INSERT into table2( p_value )
select 135 union all
select 121 union ALL
select 156 union all
select 131;select *, count(*)
from table1 as a
left join table2 as b on instr( CONCAT( ',', a.u_value, ',' ), CONCAT( ',', b.p_value, ',' ) ) > 0
group by u_value;
create table table1(
u_id int,
u_value varchar(100)
);
drop table if exists table2;
create table table2(
p_value varchar(100)
);insert into table1( u_id, u_value)
select 1, '135,178,129,135,241' union ALL
select 2, '120,121,137' union all
select 3, '156,131,134,123,134' union all
select 4, '100,200';INSERT into table2( p_value )
select 135 union all
select 121 union ALL
select 156 union all
select 131;select *, count(*)
from table1 as a
left join table2 as b on instr( CONCAT( ',', a.u_value, ',' ), CONCAT( ',', b.p_value, ',' ) ) > 0
group by u_value;
(select count(*) from b where find_in_set(b.p_value,a.u_value)) as result
from a
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
http://community.csdn.net/Help/HelpCenter.htm#结帖