Rank or Sum Until Value Reached

Not applicable

Rank or Sum Until Value Reached

Hi to all,

My question is if it is possible in teradata sql to have a rank or a sum until a value is reached and then start again the rank or the sum.

I have 2 Tables: In one are parking house id's and haw many place are free. In the other table are customers id's and they have a number of cars.

What i have to do is to order the cars in the parking house.

park_id || free_places

a123          125

b123          250

c123          100

d123            50

e123             1

customer_id || nr_of_cars

1234                 3

2345                 2

3456                 20

4567                 25

5678                  5

6789                55

7891              220

so i would need to build a cumulativ sum over the nr_of_cars until i reach the number of free places in the first parkinghouse and then start again for the second parking house and so on. Is also wished that the parkings are filled as evenly as possible. Another condition is that one customer schould be able to park all his cars in the same parkingplace.

Is this in teradata possible?

Thank you and a good day


Re: Rank or Sum Until Value Reached

What is the volume of the tables?