× 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.



This is selecting records where XMMAIL and XMSmn1 are "distinct".  You want
to use GROUP BY on the column (or columns) that you want to have only oneof,
and a summarization command (min, max, average, sum) on the remaining
columns.

Something like ...
INSERT INTO NEWSYS/EMLCMP (EMLADDR, EMEMP#) SELECT XMMAIL,
min(XMSmn1) FROM posmstp WHERE xmmail <> ' '  GROUP BY XMMAIL

Have fun ...

On 10/3/06, Michael Ryan <michaelrtr@xxxxxxxxx> wrote:

I thought I could do this, but it's not working for me. Here's my SQL
statement:

INSERT INTO NEWSYS/EMLCMP (EMLADDR, EMEMP#) SELECT DISTINCT XMMAIL,
XMSmn1 FROM posmstp WHERE xmmail <> ' '

I have records in posmstp like this:

XMMAIL     XMSMN1
A_Value      501
B_Value      123
A_Value      789
C_Value      555

I want the resultant table to be:

XMMAIL     XMSMN1
A_Value      501
B_Value      123
C_Value      555

In other words, I just want the values from the first XMMAIL record I
encounter. I though the DISTINCT would do that. What do I need to do?

TIA
--
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: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.