1

这可能已经被回答或者可能太容易了,但我还没有找到适合我的东西,所以我在这里。

我想要做的是列出具有 2 种匹配记录的人员列表,这就是我所拥有的:

----------------------------------------------------
| user_id | username | total_exp | exp_since_death |
| 1       | test     | 123       | 123             |
| 2       | abd      | 112       |  43             |
| 3       | bcd      | 144       | 144             |
| 4       | def      |  90       | 50              |
| 5       | asdf     | 173       | 173             |
| 6       | zxvf     | 220       | 113             |
----------------------------------------------------

这就是我想要展示的:

  • 1 - 测试 - 123
  • 3 - bcd - 144
  • 5 - 自卫队 - 173

我怎样才能做到这一点?两个列,total_exp 和 exp_since_death,必须具有相同的值。非常感谢。

4

3 回答 3

7
select user_id, username, total_exp
from yourtable
where total_exp = exp_since_death;
于 2012-05-18T13:55:58.100 回答
1
Select user_id, username, total_exp from table
where total_exp = exp_since_death
于 2012-05-18T13:58:00.890 回答
0

使用此查询:

select * from table1 where total_exp = exp_since_death 
于 2012-05-18T13:58:24.277 回答