I have the following query:
SELECT year_week FROM web_details where location = ''JF'' AND property_id = ''FARM''
which produces the following results.
YEAR_WEEK
201035
201036
201037
201039
201041
201044
201045
201048
What I actually want is to produce a set of results which only displays values if the consecutive value is available - so producing the following results...
YEAR_WEEK
201035
201036
201044
Anyone know how to do this? Thanks
Got the answer with a little help from here. Thanks
SELECT year_week FROM web_details w
WHERE location = ''JF'' AND property_id = ''FARM'' AND EXISTS (
SELECT * FROM web_details
WHERE location = ''JF'' AND property_id = ''FARM''
AND cast(year_week as numeric) = cast(w.year_week as numeric) + 1
)