Hi,
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
Code:
AND pl.start_date IN (
SELECT max(live.start_date)
FROM product_live live
WHERE start_date <= ? #$arrival_date_requested
AND live.id=pl.id
AND business_id = ? -- successful thus far
THEN
if (live.end_date <= ?) #$departure -- trying to get the end_date from the same record as in 1st part
select min(live.start_date)
from product_live AS live
where end_date >= ? #$arrival_date_requested
AND live.id=pl.id
AND business_id = ?
)
for clarity: the relevant table cols are like this
| 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.
bazz