Forum Moderators: coopster

Message Too Old, No Replies

2 then in an case statement mysql

         

helenp

5:17 pm on Nov 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi I have this select:
(select
(CASE WHEN ('$llegada' BETWEEN baja_inicio AND baja_fin and '$salida' BETWEEN baja_inicio AND baja_fin)
THEN sum(precio_baja) * (TO_DAYS('$salida') - TO_DAYS('$llegada')) ELSE NULL END) as price
(CASE WHEN etc

As you can see the days between is * by the price in precio_baja column,

What I want to do is to use the same to_days to get how many days there are without doing another select.

Something like this:
THEN sum(precio_baja) * (TO_DAYS('$salida') - TO_DAYS('$llegada') as days) AS price ELSE NULL END),

THEN sum(precio_baja) * (TO_DAYS('$salida') - TO_DAYS('$llegada')) AS price AND (TO_DAYS('$salida') - TO_DAYS('$llegada')) as days ELSE NULL END),

So far only gets errors

coopster

1:15 pm on Nov 16, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



What errors are you receiving?