|
Ok, going from the top of my head here, how about: SELECT DUNS, TMSTMP FROM CDATA T1 WHERE TMSTMP=(SELECT MAX(TMSTMP) FROM CDATA T2 WHERE T1.DUNS=T2.DUNS) or maybe: SELECT DUNS, MAX(TMSTMP) FROM CDATA GROUP BY DUNS I think the latter would definitely work....... hth eric.delong@pmsi-services.com ______________________________ Reply Separator _________________________________ Subject: Re: SQL Author: <MIDRANGE-L@midrange.com> at INET_WACO Date: 2/3/00 11:01 AM Thanks Rob and others, but my goal is a list, not a single row! in otherwords I want all duns with the max timestamp for each duns. In the example there were two duns that have two timestamps, I want the greater timestamp of the two along with all of the other rows which have only one timestamp and this seems such a simple thing but is driving me nuts! I marked the desired result set with an "*". . . . 003387891 0033878910013 . . . -----Original Message----- From: Rob Berendt [mailto:rob@dekko.com] Sent: Wednesday, February 02, 2000 3:58 PM To: MIDRANGE-L@midrange.com Subject: Re: SQL SELECT DUNS, TMSTMP FROM CDATA WHERE TMSTMP IN(SELECT MAX(TMSTMP) FR OM CDATA) hweatherly@dlis.dla.mil on 02/02/2000 03:48:24 PM How can I construct an sql statement to select the highest value along with additional information? I have tried select duns, max(tmstmp) from cdata but this seems to fuss about the MAX function, any help will be appreciated because I believe I am going nuts here! CDATA table DUNS TMSTMP 003253390 2000-01-27-07.51.03.971320 * 003299534 2000-01-24-08.32.25.182200 * 003301959 2000-01-25-10.16.11.563368 * 003321171 2000-01-28-07.32.22.707568 * 003387891 2000-01-24-08.32.25.208280 003387891 2000-01-28-07.32.22.719080 * 0033878910013 2000-01-24-08.32.25.245328 0033878910013 2000-01-27-07.51.03.974312 * 003420841 2000-01-26-11.10.11.521704 * 003424470 2000-01-24-13.17.37.531624 * 003479797 2000-01-28-07.32.22.755704 * Howard Weatherly (616)961-4324 Logicon +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
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.