Hello,
I'm stuck a bit with the following problem and hope somebody will have an idea which might help.
So, I have a table about flats. In the fields of the table, among others, there is a date field which represents the starting date of the flat availability. I'd like to create a query which displays the available nights per flat for each month in the current year. For example, Flat1 is available from 11.08.2014, then I'd like to see in the query result 20 nights for August and 30 for September, 31 for October and so on.
I created a query which displays only the dates for the current year. Then I joined this query with the Flats table, the join condition is query.date >= flat.valid_from_date and displayed 1 in each row in the result as night. This way, I have the available flats for each day with 1 as available night. Then I tried to summarize the number of nights by month and flat. Unfortunately, in the result of this query I got two times bigger number than the number of the actual month for each flat, independently from the availability of the flat in the given month. I could not figure out where I made mistake.
Sorry if it's a bit long!
Thank you in advance for any small piece of idea or suggestion!
VoiD
I'm stuck a bit with the following problem and hope somebody will have an idea which might help.
So, I have a table about flats. In the fields of the table, among others, there is a date field which represents the starting date of the flat availability. I'd like to create a query which displays the available nights per flat for each month in the current year. For example, Flat1 is available from 11.08.2014, then I'd like to see in the query result 20 nights for August and 30 for September, 31 for October and so on.
I created a query which displays only the dates for the current year. Then I joined this query with the Flats table, the join condition is query.date >= flat.valid_from_date and displayed 1 in each row in the result as night. This way, I have the available flats for each day with 1 as available night. Then I tried to summarize the number of nights by month and flat. Unfortunately, in the result of this query I got two times bigger number than the number of the actual month for each flat, independently from the availability of the flat in the given month. I could not figure out where I made mistake.
Sorry if it's a bit long!
Thank you in advance for any small piece of idea or suggestion!
VoiD