1

我有这样的两列值的表,

Question             Answer
---------            -------
10#9                 yes#no
10#2                 no#yes
10#9                 yes#no
18#10                yes#no
16#1                 peter#roy
11#2                 simon#yes

我必须找到问题 id 10 的出现并回答是

查询喜欢

select count( ) from table name where id= 10 and answer='yes' *

可能吗?

4

1 回答 1

1

SELECT COUNT(*) TotalCount FROM tablename WHERE (Question LIKE CONCAT(value, '%') AND Answer LIKE 'yes%') OR (Question LIKE CONCAT('%', value) AND Answer LIKE '%yes')

于 2013-05-28T06:37:30.440 回答