Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum Qty

Status
Not open for further replies.

TariqMehmod

Programmer
Mar 4, 2004
100
0
0
PK
Dear Experts
I have this data in table called Table1

Qty Amount

500 1
600 2
700 3
700 4
700 5
700 6
700 7
700 8
700 9
800 10
900 11
1000 12
1100 13
1200 14
1300 15
1300 16
1300 17
1400 18
1300 19
1300 20
1400 21


I want to get data showing with arrow.

1300 15


Logic

What maximum qty is being used as maximum time?

qty 1400 is maximum but it is being used only 2 times
qty 1300 is not maximum but it is being used 5 times.
qty 700 is not maximum but it is being used 7 times.

So I need a maximum qty based on maximum times with its respective amount like

1300 15 (First occurrence)
Both conditions : maximum qty with maximum number of usage.

Please
 
If you want 1200 from this your condition is not well defined. The max number of usage is for qty 700, as you say yourself.

If you want 1300 because 1300*5 is larger than 700*7, then say so, then the product of count and qty is what you want to maximize.

Bye, Olaf.


Olaf Doschke Software Engineering
 
Thanks sir for helping, but I did not ask for 1200

I do not want to multiply later for any costing purpose.

I need maximum occurrence with highest qty.

qty 1400 is maximum but it is being used only 2 times
qty 1300 is not maximum but it is being used 5 times.
Qty 700 is being used 7 times but it is not a maximum.

Both conditions : maximum qty with maximum number of usage.

Regards
 
1200 was just a typo.

max count is 7
max qty with that max count is 700, as only 700 has that count. For that reason what you want isn't a condition that can be applied.

max qty is 1400, it has not max count.
There is no qty with 7 as count higher than 700, the best condition you have is looking for the qty where qty*count is maximum, which is your wanted 1300. So that's your condition rephrased in a computable way.

What you say the way you say it is not computable.

Bye, Olaf.


Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top