想象一个简单的情况,您要么是designer
,developer
要么reviewer
存储在work
这样的表中:
+----+----------+-----------+----------+
| id | designer | developer | reviewer |
+----+----------+-----------+----------+
| 1 | sudo_O | fred | bob |
| 2 | fred | bob | sudo_O |
| 3 | bob | sudo_O | fred |
| 4 | sudo_O | fred | bob |
| 5 | bob | sudo_O | fred |
| 6 | fred | bob | sudo_O |
| 7 | fred | bob | john |
| 8 | john | bob | fred |
+----+----------+-----------+----------+
要查询表以查找我的所有工作将是:
select * from work where designer='sudo_O' or developer='sudo_O' or reveiwer ...
是否可以按工作类型(即设计、开发、审查)对结果进行排序,如下所示:
1, sudo_O, fred, bob
4, sudo_O, fred, bob
3, bob, sudo_O, fred
5, bob, sudo_O, fred
2, fred, bob, sudo_O
6, fred, bob, sudo_O
这就是我的所有设计工作首先展示,然后是开发,然后是审查。