Re: sql query problem
From: Joe Nardone <joe_at_access5.digex.net>
Date: 1996/01/19
Message-ID: <4donk9$h48_at_news4.digex.net>#1/1
Date: 1996/01/19
Message-ID: <4donk9$h48_at_news4.digex.net>#1/1
Heather Dyson (heather.dyson_at_template.com) wrote:
: I have a table that has a primary key of
: number, code, month
:
: Let's say that I have the following data
:
: number code month
: ------ ---- -----
: 1 a 1
: 1 b 1
: 1 b 2
:
: example would be
:
: number code month
: ------ ---- -----
: 1 a 1
: 1 b 2
:
A combination of MAX/group by should do it.
Select number, code, max(month) from table group by number, code
Joe
-- =------------------------------------------------------------------= Joe Nardone <joe_at_access.digex.net> "Now that I have my coffee, I'm ready to watch radar." -----BEGIN PGP PUBLIC KEY BLOCK----- Version: 2.6.2 mQBtAzCg5QoAAAEDANvEmc4OAT8wntnCv8UPjyD2kohKVGa1CU21PLpYljzl3AE7 pldpNNscKSoE//aVMKYBO+tRFTTsPNi0qZ6CDlEBXTgJAiszoHh1qCzZyYj7FTBL YoUr+3sk9rU8Pma6AQAFEbQiSm9lIE5hcmRvbmUgPGpvZUBhY2Nlc3MuZGlnZXgu bmV0Pg== =1ocE -----END PGP PUBLIC KEY BLOCK-----Received on Fri Jan 19 1996 - 00:00:00 CET