Say I have a table of the form:
+-----+-------+
| Key | Value |
+-----+-------+
| A | 1 |
| A | 3 |
| A | 4 |
| B | 2 |
| B | 3 |
| C | 3 |
| C | 4 |
| C | 5 |
+-----+-------+
I want to be able to return all of the keys that have at least a given range.
For example:
A query for a Value range of 2 would return A, B, C
A query for a Value range of 3 would return A, C
A query for a Value range of 4 would return A
Can this be done with SQL (specifically SQLite)? If so, how?
MIN
andMAX
for that key?