G
Ghena
Hi to everybody.
The problem is very simple, I suppose:
I need to use this value:
IIf([store_2.ID_ROOM]=1,[@sgl],IIf([store_2.ID_ROOM]=2,[@dbl],[@tpl]))
AS valore
in the following espression:
IIf(IsNull([tot_pax]-([valore])),0-[valore],[tot_pax]-[valore]),IIf(IsNull([allottment]-[tot_pax]-[valore]),[allottment]-[valore],[allottment]-[tot_pax]-[valore]))
AS DISPREALE
At the moment is not possible to execute the query becouse
the expression:
IIf(IsNull([tot_pax]-([valore])),0-[valore],[tot_pax]-[valore]),IIf(IsNull([allottment]-[tot_pax]-[valore]),[allottment]-[valore],[allottment]-[tot_pax]-[valore]))
AS DISPREALE
seems to be not included in the GROUP BY:
This is the whole query.
SELECT hotel.ID_hotel, hotel.insegna, store_2.ID_room,
IIf(IsNull([TOT_PAX]),0,[TOT_PAX]) AS TOT, store_2.allottment,
IIf([store_2.ID_ROOM]=1,[@sgl],IIf([store_2.ID_ROOM]=2,[@dbl],[@tpl]))
AS valore,
IIf(DateAdd('d',[realease],Date())>=#5/28/2006#,IIf(IsNull([tot_pax]-([valore])),0-[valore],[tot_pax]-[valore]),IIf(IsNull([allottment]-[tot_pax]-[valore]),[allottment]-[valore],[allottment]-[tot_pax]-[valore]))
AS DISPREALE, store_2.realease, DateAdd('d',[realease],Date()) AS
stato, camere.tipo_room
FROM ((hotel INNER JOIN store_2 ON hotel.ID_hotel = store_2.ID_hotel)
LEFT JOIN store1 ON (store_2.ID_room = store1.id_room) AND
(store_2.ID_hotel = store1.ID_hotel)) INNER JOIN camere ON
hotel.ID_hotel = camere.ID_hotel
GROUP BY hotel.ID_hotel, hotel.insegna, store_2.ID_room,
IIf(IsNull([TOT_PAX]),0,[TOT_PAX]), store_2.allottment,
IIf(DateAdd('d',[realease],Date())>=#5/28/2006#,IIf(IsNull([tot_pax]-([valore])),0-[valore],[tot_pax]-[valore]),IIf(IsNull([allottment]-[tot_pax]-[valore]),[allottment]-[valore],[allottment]-[tot_pax]-[valore])),
store_2.realease, camere.tipo_room
HAVING (((store_2.ID_room) In (3,1)));
thanks a lot.
The problem is very simple, I suppose:
I need to use this value:
IIf([store_2.ID_ROOM]=1,[@sgl],IIf([store_2.ID_ROOM]=2,[@dbl],[@tpl]))
AS valore
in the following espression:
IIf(IsNull([tot_pax]-([valore])),0-[valore],[tot_pax]-[valore]),IIf(IsNull([allottment]-[tot_pax]-[valore]),[allottment]-[valore],[allottment]-[tot_pax]-[valore]))
AS DISPREALE
At the moment is not possible to execute the query becouse
the expression:
IIf(IsNull([tot_pax]-([valore])),0-[valore],[tot_pax]-[valore]),IIf(IsNull([allottment]-[tot_pax]-[valore]),[allottment]-[valore],[allottment]-[tot_pax]-[valore]))
AS DISPREALE
seems to be not included in the GROUP BY:
This is the whole query.
SELECT hotel.ID_hotel, hotel.insegna, store_2.ID_room,
IIf(IsNull([TOT_PAX]),0,[TOT_PAX]) AS TOT, store_2.allottment,
IIf([store_2.ID_ROOM]=1,[@sgl],IIf([store_2.ID_ROOM]=2,[@dbl],[@tpl]))
AS valore,
IIf(DateAdd('d',[realease],Date())>=#5/28/2006#,IIf(IsNull([tot_pax]-([valore])),0-[valore],[tot_pax]-[valore]),IIf(IsNull([allottment]-[tot_pax]-[valore]),[allottment]-[valore],[allottment]-[tot_pax]-[valore]))
AS DISPREALE, store_2.realease, DateAdd('d',[realease],Date()) AS
stato, camere.tipo_room
FROM ((hotel INNER JOIN store_2 ON hotel.ID_hotel = store_2.ID_hotel)
LEFT JOIN store1 ON (store_2.ID_room = store1.id_room) AND
(store_2.ID_hotel = store1.ID_hotel)) INNER JOIN camere ON
hotel.ID_hotel = camere.ID_hotel
GROUP BY hotel.ID_hotel, hotel.insegna, store_2.ID_room,
IIf(IsNull([TOT_PAX]),0,[TOT_PAX]), store_2.allottment,
IIf(DateAdd('d',[realease],Date())>=#5/28/2006#,IIf(IsNull([tot_pax]-([valore])),0-[valore],[tot_pax]-[valore]),IIf(IsNull([allottment]-[tot_pax]-[valore]),[allottment]-[valore],[allottment]-[tot_pax]-[valore])),
store_2.realease, camere.tipo_room
HAVING (((store_2.ID_room) In (3,1)));
thanks a lot.