This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I have a table with 1000's of numeric values in a 'checkInDay' column where day is the number of days since 1st Jan 1970.
'checkInDay'
14610
14612
14616
14617
14618
14619
14621
14622
14625
So if my query is looking for 3 nights it would be able to pull out 14616,14617,14618 from the above as these are the first 3 sequential days available but exclude 14619 as this is a 4th night and I am looking for only 3
At the moment I check for availability on a set night using the query below but I'm struggling to refactor this to check for the next set of available dates.
SELECT CASE WHEN (
SELECT count(id) as cnt
FROM availability
WHERE roomType = 'R1'
AND checkInDay IN (18612, 18613, 18614) ) = 3
THEN 'true'
ELSE 'false'
END as allNightsAvailable;
Post Details
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/mysql/comme...