Re: Distinct Max Value?

From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 01/18/05


Date: Mon, 17 Jan 2005 19:20:28 -0500

rjcmbc wrote:
> Ok, here is my Create Table Script:
>
> SELECT r.runNumber,

Umm, that is not a Create Table script. I can tell because the script does
not contain the words "CREATE TABLE". :-)

> As you can see I am trying to extract the maximum number from the
> 'SignOffTime' field. This is an INT data type btw.

Well that is what I wanted to know. So let's see a real "CREATE TABLE"
script (trim it down to the columns that are relevant to this issue after
you use Enterprise Manager to generate it (see the aspfaq url I posted
earlier)
some INSERT statements containing sample data so we can see how the data is
stored, and some unioned select statements to generate the results you wish
to return from the sample data you provide

>
> However, I don't seem to be getting the desired result. I get the MAX
> SignOffTime value for all 'RunNumbers' instead of just the one Max
> value for each runnumber group.

You need a GROUP BY clause. See my previous response.

-- 
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM" 


Relevant Pages

  • Re: Looping/Counting
    ... second script bins the information for each 10 percent of the data. ... The last decile is further broken down into ... It turns out that for many deposits, 1% of the sample data ...
    (comp.lang.awk)
  • Re: Need help
    ... Hi Mjuricek, ... enough information to know what the script does. ... Include all constraints but exclude irrelevant ... based on the sample data you gave. ...
    (microsoft.public.sqlserver.programming)
  • Help: Odd Output
    ... I wrote a script to check the location. ... Here's my codes. ... if ($num <= 2) ... Here's the sample data. ...
    (comp.lang.perl.misc)
  • Re: Splitting and comparing file names
    ... with the general format would really be much preferred... ... sample data would be nice. ... You have a case of premature declaration. ... previous script that required it because of a write to the directory. ...
    (perl.beginners)
  • Re: script help - stripping trailing spaces in exisitng script
    ... below script on the below sample data. ... The only problem is the trailing spaces at the end of each line. ... A quick web search put me onto ... original to just include all this in a single script. ...
    (comp.lang.perl.misc)