I’ve got a table which contains week numbers and id’s
| id | week |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 8 |
What I need to do is retrieve based on the value of week. But I also need to return the row more than once if the row is greater than a certain number.
For instance (pseudo),
if week > 2
and week > 6
| id | week |
| 2 | 2 |
| 3 | 6 |
| 3 | 6 |
| 4 | 8 |
| 4 | 8 |
ID 3 & ID 4 appear twice, because they’re greater than both 2 and 6. ID 2 will only appear once because it is only greater than 2.
Unfortunately looped queries are sort of out of the question as this query will be return 2k+ rows.
Any help will be greatly appreciated, even if the solution is PHP based.
UNION.The following should give you the result you want.
edited included the hint by Lily – thx.