How to sum data from 2 repeating groups – Database


Greetings to all. And I always appreciate the help.

I want to get the total value of the sum of a field from 2 different groups.

  • The idea is that a client selects a range of dates for an “accommodation” and returns the total price that he must pay for the selected nights.

1- I have the “accommodations” data table that contains base prices for weekdays “Price-NightWeek” and base prices for weekends “Price-Weekend”
From here I multiply the selected days by the value of the day (Monday=1 Tuesday=2 etc.)

2-I have a data table “Price-x-night” where I store the “price” (it can be a negative number if it is an offer) for lists of dates, linked to an accommodation.

Here is my problem
How can I find the value and “add or subtract” the value of each day by selecting a date range from a date/time picker?

I manage to get the date range, but not the sum of the value assigned to each date



Source link

Leave a Comment