我有 2 个这样的表:
Table 1
-------
ID
score
Table 2
-------
ID
score_from
score_to
如果基于表 2 中的 score_from 和 score_to 在 Table1 中有 score='12' ,我如何从表 2 中获取 ID?
Contents of Table1:
----------------------
ID |Score |
----------------------
1 |12 |
----------------------
2 |40 |
----------------------
Contents of Table2:
------------------------------
ID |score_from|score_to|
------------------------------
1 |0 |20 |
------------------------------
2 |21 |40 |
------------------------------
如果我从 table1 获得 score='12',我该如何编写查询以在 table2 中获取 ID='1'?