I am running a sub query which has to do a 'thing'.
when that 'thing' is done, I need then to perform another 'thing' so, the second 'thing' is conditional on the outcome of the first.
I have been working on this main query for about 2 weeks now so I am getting desperate.
here's the query with some pseudo code where I am stuck
for clarity: the relevant table cols are like this
AND pl.start_date IN (
FROM product_live live
WHERE start_date <= ? #$arrival_date_requested
AND business_id = ? -- successful thus far
if (live.end_date <= ?) #$departure -- trying to get the end_date from the same record as in 1st part
from product_live AS live
where end_date >= ? #$arrival_date_requested
AND business_id = ?
| start_date | end_date | price |
I need help with the red bit because whether it runs, is determined by the value returned by the first part of the sub query.
any pointers at all would be most welcome.