Skip to content
Advertisement

Tag: range

How to calculate sum of a value with only “day of week” using a date-range?

I have 2 tables namely Item table with details of item_id, store_id, offer_start_Date and offer_end_date Store table has store_id, day_of_week, store_hours The structure of both tables are follows – 1) Item_Table : Store ID Item ID offer_start_Date offer_end_date NY0001 FMC0001 2021-10-30 2021-11-04 NY0001 FMC0002 2021-11-08 Null NY0002 FMC0003 2021-11-02 2021-11-02 NY0002 FMC0004 2021-09-01 2021-10-10 2) Store Table : Store ID

How can I partition by group that falls within a time range?

I have the following table showing when customers bought a certain product. The data I have is CustomerID, Amount, Dat. I am trying to create the column ProductsIn30Days, which represents how many products a customer bought in the range Dat-30 days inclusive the current day. For example, ProductsIn30Days for CustomerID 1 on Dat 25.3.2020 is 7, since the customer bought

How to calculate the average value of following n rows based on another column – SQL (Oracle) – updated version of previously answered question

I am trying to calculate average monthly value of PREMIUM for each POLICY_ID in monthly basis as shown below screenshot. When a customer updates his/her yearly PAYMENT_FREQUENCY to a value different than 12, I need to manually calculate the average monthly value for the PREMIUM. In addition, average monthly PREMIUM amount can be changed in time. For instance, for the

Advertisement