用户表o_user_info:
userId |
userName |
0 |
张三峰 |
10 |
李四 |
2 |
李雷 |
3 |
王五 |
1.搜索姓名中有“峰”字的用户的ID
<span style="font-size:12px;">select userId from o_user_info where username like ‘%峰%’;</span>
2.搜索用户ID为2,0的用户;
<span style="font-size:12px;">select* from o_user_info where userId in(2,0);</span>
用户使用浏览器情况表o_browser_info:
id |
browser |
userId |
100 |
IE6 |
0 |
101 |
IE7 |
2 |
102 |
IE8 |
3 |
103 |
IE9 |
10 |
104 |
Chrome |
1 |
3.输入用户id:2,3,10,搜索出这些用户使用的浏览器情况
<span style="font-size:12px;">select * from o_browser_info
where charindex(‘,’+ltrim(userId)+',',',2,3,10,')>0</span>