June 22, 2011 at 11:16 am
Hello all from a total SQL newb. I am not really a DB guy but have inherited the occasional random task. The latest is that I need to find and then remove several jobs from the DB that are no longer valid. I have the query listed below but that requires that I enter every job number individually. I was wondering if there was a way to have the query select everything between say job numbers 598525 - 598998? I tried just replacing the '589525', '598526',…..etc with ('598525' - '598998')) but that failed.
So can this be done?
Thanks
Chris
Select * from srg_job_status where srg_job_refid in (select srg_job_id
from
srg_job d
where
d.home_job_id in ('587786', '587787', '587788', '587789', '587790'))
June 22, 2011 at 11:24 am
We just had a question of the day with the BETWEEN filter in it.
BETWEEN includes the beginning and ending values.
Select *
from srg_job_status
where srg_job_refid in
(select srg_job_id
from srg_job d
where d.home_job_id BETWEEN '587786' and '587790')
June 22, 2011 at 11:25 am
where jobid BETWEEN value1 and value2
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply