× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I created a file from your first example, called STYLEPF
Record# Style Class Qty.
1 J4JK2205 3 17
2 J4JK2205 4 4
3 J4LW2700 3 21
4 J4LW2700 4 106
5 J4LW2701 4 31
6 J7GM0558 1 2
7 J7GM0558 4 6
8 J7GM0558 6 4
9 J7JE0101 4 5
10 J7RC2521 1 49
11 J7RC2521 4 11

I then ran the following SQL
with maxsty as
(SELECT STY,
max(QTY) as MaxQty FROM axslib.stylepf GROUP BY STY ORDER BY
sty)
select a.sty, b.cls, a.MaxQty from maxsty a join axslib.stylepf b
on
a.sty = b.sty and
a.maxqty = b.qty

with the following results
STYLE CLASS MAXQTY
J4JK2205 3 17
J4LW2700 4 106
J4LW2701 4 31
J7GM0558 4 6
J7JE0101 4 5
J7RC2521 1 49

Which is what I believe you are looking for
The SQl wiill need to be tweaked where there is more than one record that fits the criteria


Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill


-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Art Tostaine, Jr.
Sent: Wednesday, May 30, 2018 9:25 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: Re: [EXTERNAL] Re: Sql select max value question

3 or 4 wouldn't matter. that's going to be rare since we are dealing with 10's of thousands.

Art

On Wed, May 30, 2018 at 9:17 AM, Alan Shore <ashore@xxxxxxxx> wrote:

Hi Art
What do you want to see if the data was like this where STY J4JK2205
for TWO different classes has the same qty?
STY CLS sumqty
J4JK2205 3 17
J4JK2205 4 17
J4LW2700 3 21
J4LW2700 4 106
J4LW2701 4 31
J7GM0558 1 2
J7GM0558 4 6
J7GM0623 6 4
J7JE0101 4 5
J7RC2521 1 49
J7RC2521 4 11

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Art Tostaine, Jr.
Sent: Wednesday, May 30, 2018 9:13 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: [EXTERNAL] Re: Sql select max value question

This code returns this data. It's for a pick operation, based on the
class of a style that has the m most quantity, I have to match the
class to a zone in the warehouse.

select sty, cls, sum(qty) as sumqty
from whso312f
where sty <> ' '
group by sty, cls
order by sty, cls

STY CLS sumqty
J4JK2205 3 17
J4JK2205 4 4
J4LW2700 3 21
J4LW2700 4 106
J4LW2701 4 31
J7GM0558 1 2
J7GM0558 4 6
J7GM0623 6 4
J7JE0101 4 5
J7RC2521 1 49
J7RC2521 4 11

I want to get this: If qty is in the query that's ok.

STY CLS
J4JK2205 3
J4LW2700 4
J4LW2701 4
J7GM0558 4
J7GM0623 6
J7JE0101 4
J7RC2521 1
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD




--
Art Tostaine
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.