var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Record with NULL values
I have a table with a list of hotels, and another table with the reservations.
I want to make a simple statistic with the total number of nights for each hotel.
This query works fine:
but, if I add this clause -->
SELECT DISTINCT b.name, b.city, SUM(a.nights) AS nights
FROM reservation A, hotels B
WHERE a.id_hotel(+) = b.id_hotel
GROUP BY b.name, b.city ORDER by b.name
it doesn't extract anymore the hotels without any reservation (nights = 0).
AND TRUNC(a.dateBegin) <= NVL(TRUNC(TO_DATE('" + Session["src_dateBegin"] + "','dd/mm/yyyy')),TRUNC(TO_DATE('31/12/2999','dd/mm/yyyy')))
AND TRUNC(a.dateEnd) >= NVL(TRUNC(TO_DATE('" + Session["src_dateEnd"] + "','dd/mm/yyyy')),TRUNC(TO_DATE('01/01/1900','dd/mm/yyyy')))"
How should I write my query to get a full list with all the hotels, even though I have a clause on the date?
I just found out that it's enough to use
"a.dateBegin(+)" and "a.dateEnd(+)" to get the null values, too...