I have a table with a job # and a suffix. The query i'm trying to create selects a range of job # / suffix entries where the suffix is dependant upon the job #. So for example:
Job # Suffix
-------- -----------
00000001 001
00000001 002
00000001 003
00000002 001
00000002 002
00000002 003
00000002 004
00000003 001
00000003 002
00000003 003
00000003 004
I have four inputs. One pair is the starting job / suffix and then the ending job / suffix. If the user inputs:
Starting: 00000001 / 002
Ending: 00000002 / 002
They'll get the following results:
Job # Suffix
-------- -----------
00000001 002
00000001 003
00000002 001
00000002 002
I want to know if there's a simple way to do this in one select statement in my stored proc. The only way I thought to do it so far would be to select the jobs first into a table variable then filtering the suffix with another query.
This seems simple, but having difficulty wrapping my brain around this one.
Thanks!