Re: Max



On Mon, 7 Nov 2005 08:31:14 -0800, Travis wrote:

>Hi ,
>
> I have a list of data as show below ,
>
> Data1 Update Date
> --------- ------------
> 1 01-01-2004
> 2 01-01-2004
> 3 01-01-2004
> 1 01-01-2005
> 2 01-01-2005
> 3 01-01-2005
>
> How can I build a query to select the "latest" update date data from this
>list ?

Hi Travis,

Your question is not reallly clear. Providing expected output would have
been helpful. (And posting CREATE TABLE and INSERT statements even more;
check www.aspfaq.com/5006).

Anywway, here are two possible answers for two possible interpretations
of your question:

SELECT MAX("Update Date")
FROM YourTable

SELECT Data1, MAX("Update Date")
FROM YourTable
GROUP BY Data1


Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
.



Relevant Pages

  • Number of duplicate record
    ... I need help writing a query that can tell me the number of records with the ... this is my database (Data1 only has 1 column) ...
    (microsoft.public.sqlserver.programming)
  • Re: Number of duplicate record
    ... Select countFrom Data1 Where numbers = 234 ... > I need help writing a query that can tell me the number of records with ... > the query should like something like this ...
    (microsoft.public.sqlserver.programming)