I’m trying to learn SQL and trying to write a SQL Query that does the following:
I have two tables:
SalaryRangeTable: id, beginRange, endRange
UserInfoTable: id, salary, ...
I want to first:
Iterate through SalaryRangeTable, select beginRange and endRange
Then for each entry in that table, I want to be able to:
SELECT id FROM UserInfoTable WHERE salary > beginRange AND salary < endRange
Therefore, my result set will include all the UserInfoTable id’s that have that range.
Any ideas?
Thanks.
1 Answer