Walden's is the simplest, probably. But another syntax illustrates using a
subselect as a table:

select count(*) from (select distinct VHIDTEfrom plpvh) as x

This generates (conceptually, at least) an internal temporary result that
can be handled just like an existing table. Needs to be a fairly recent
release, I think.

At 10:24 AM 5/9/02 -0700, you wrote:
>This message is in MIME format. Since your mail reader does not understand
>this format, some or all of this message may not be legible.
>--
>[ Picked text/plain from multipart/alternative ]
>That did it!  Thank you... I had no idea, that syntax was possible ..
>
>
> > -----Original Message-----
> > From: Walden H. Leverich [SMTP:WaldenL@TechSoftInc.com]
> > Sent: Thursday, May 09, 2002 10:20 AM
> > To:   'midrange-l@midrange.com'
> > Subject:      RE: SQL (Count/Distinct Groups) Question
> >
> > This is one of the few times you don't use a * in count(). Try
> >
> > Select count(Distinct VHIDTE)
> >  from plpvh
> >  where VHDIVN = '500'
> >
> > -Walden
> >
> >
> > ------------
> > Walden H Leverich III
> > President
> > Tech Software
> > (516) 627-3800 x11
> > (208) 692-3308 eFax
> > WaldenL@TechSoftInc.com
> > http://www.TechSoftInc.com
> >
> > Quiquid latine dictum sit altum viditur.
> > (Whatever is said in Latin seems profound.)
> >
> >
> >
> > -----Original Message-----
> > From: Hatzenbeler, Tim [mailto:thatzenbeler@clinitech.net]
> > Sent: Thursday, May 09, 2002 13:01
> > To: 'midrange-l@midrange.com'
> > Subject: SQL (Count/Distinct Groups) Question
> >
> >
> > This message is in MIME format. Since your mail reader does not understand
> > this format, some or all of this message may not be legible.
> > --
> > [ Picked text/plain from multipart/alternative ]
> > I'm stumped....  Please help...
> >
> > If I issue this command.
> > SELECT DISTINCT VHIDTE,count(*) FROM
> > plpvh WHERE VHDIVN = '500'
> > GROUP BY vhidte
> >
> > I get this....
> >  2/11/2002            533
> >  2/21/2002            112
> >  2/26/2002            210
> >  3/08/2002            173
> >  3/13/2002            322
> >  3/22/2002            247
> >  3/27/2002            292
> >  4/04/2002            266
> >
> >       But now, All I want is the number of different Dates, so in this
> > example I would like Count(*) set to : 8
> >
> >       Is that possible, In one SQL statement?
> >
> >       Thanks, TIm
> > This e-mail message, including any attachments, is for the sole use of the
> > intended recipient(s) and may contain confidential or privileged
> > information.  Any unauthorized review; use, disclosure or distribution is
> > prohibited.  If you are not the intended recipient, please contact the
> > sender by reply e-mail and destroy the message.
> > _______________________________________________
> > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
> > list
> > To post a message email: MIDRANGE-L@midrange.com To subscribe,
> > unsubscribe,
> > or change list options,
> > visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> > or email: MIDRANGE-L-request@midrange.com
> > Before posting, please take a moment to review the archives
> > at http://archive.midrange.com/midrange-l.
> > _______________________________________________
> > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
> > list
> > To post a message email: MIDRANGE-L@midrange.com
> > To subscribe, unsubscribe, or change list options,
> > visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> > or email: MIDRANGE-L-request@midrange.com
> > Before posting, please take a moment to review the archives
> > at http://archive.midrange.com/midrange-l.
>This e-mail message, including any attachments, is for the sole use of the
>intended recipient(s) and may contain confidential or privileged
>information.  Any unauthorized review; use, disclosure or distribution is
>prohibited.  If you are not the intended recipient, please contact the
>sender by reply e-mail and destroy the message.
>_______________________________________________
>This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
>To post a message email: MIDRANGE-L@midrange.com
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
>or email: MIDRANGE-L-request@midrange.com
>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.