We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e939821 commit 82b2e1cCopy full SHA for 82b2e1c
mysql开发技巧三/多属性查询
@@ -17,7 +17,15 @@ where b.skill_level>0 and c.skill_level>0 and d.skill_level>0;
17
18
使用一张物理表变成多个逻辑表多次连接的方式解决同一个属性多个值的过滤问题
19
20
-
21
22
+********************************************************************************
+过滤条件有多个,当任意两个满足就ok的SQL查询语句的思路,使用求和的方式来实现。
+select a.user_name,b.skill,c.skill,d.skill
23
+from user1 a
24
+join user_skill b on a.id=b.user_id and b.skill='念经'
25
+join user_skill c on c.user_id= b.user_id and c.skill='变化'
26
+join user_skill d on d.user_id = c.user_id and d.skill='腾云'
27
+Where (case when b.skill is not null then 1 else 0 end)
28
++(case when c.skill is not null then 1 else 0 end)
29
++(case when d.skill is not null then 1 else 0 end)
30
++(case when e.skill is not null then 1 else 0 end)>=2;
31
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments