# How to get minimum rate with different combination in SQL Query? RSS

Last post May 19, 2016 06:32 AM by Weibo Zhang

Star

8782 Points

2331 Posts

### How to get minimum rate with different combination in SQL Query?

I have one specific requirement. WE can take package weight and number of items prices are fix.

Weight 1-30   Weight 31-60  Weight 61-100   Weight 101-125 Weight 125-150

Package 1-10       100                    190                    260                    350                  420

Package 11-20     180                    280                    430                    650                  820

So if user have below package then we should set and combine, so we can set in minimum rate section. How we can write such queries?

Total 8 Package   30   weight   each   Totals 8 - 240

Total 5 Package   21    weight   each  Totals 5 - 105

Total 19 Package 10    weight each    Total 19 - 190

Amount

15   Package  wight 10   -                               150              820

4 Package 30 + 1 Package 21          120 +   21                 420

4 Package 30 + 1 Package 21          120  + 21                  420

3 Package 21  + 4 Package 10            61  + 40                 350

Please let me know if you need more help.

Regards,

Sandeep

Star

7990 Points

1586 Posts

### Re: How to get minimum rate with different combination in SQL Query?

May 19, 2016 06:32 AM|Weibo Zhang|LINK

Hi Das.Sandeep,

#### Das.Sandeep

So if user have below package then we should set and combine, so we can set in minimum rate section

My understanding of below demo is 8*1 to 8*30

`Total 8 Package   30   weight   each   Totals 8 – 240`

But, how to understand the 420 of below demo?  I guess the “30” and “31” are the weight value, the “4” and “1” are the package count, but how to get the 420 result?

Here, I guess the “4 Package 30” means there are 4 packages and each weight one of them is 30, so everyone’s price should be 100. If it’s “11 package 30”, every price should be 180. Am I right?

`4 Package 30 + 1 Package 21          120 +   21                 420`

Besides, according to the example record, how to calculate the minimum rate?

Best Regards,

Weibo Zhang