Re: Simple count query not so simple...
From: Chris E. (ChrisE_at_discussions.microsoft.com)
Date: 09/24/04
- Next message: anonymous_at_discussions.microsoft.com: "track rent"
- Previous message: SHIPP: "Re: Union query duplicates"
- In reply to: Michel Walsh: "Re: Simple count query not so simple..."
- Next in thread: Michel Walsh: "Re: Simple count query not so simple..."
- Reply: Michel Walsh: "Re: Simple count query not so simple..."
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Sep 2004 09:13:05 -0700
Cool it seems to be working but what do i do with this line?
> PIVOT fieldName IN( null )
What is the fieldName? and what do i put in place of null?
Thanks for your help.
Chris Ehmen
"Michel Walsh" wrote:
> Hi,
>
>
> TRANSFORM COUNT(fieldName) As TheValue
> SELECT groupName, COUNT(TheValue) As DistinctCount, COUNT(*) As TotalCount
> FROM myTable
> GROUP BY groupName
> PIVOT fieldName IN( null )
>
>
> would return, per groupName, the number of distinct values of fieldName, and
> the number of records.
>
>
> Alternatively, you can use
>
> SELECT COUNT(*)
> FROM ( SELECT DISTINCT fieldName FROM myTable)
>
>
> to get the total number of distinct values of fieldName (no group).
>
>
>
> Hoping it may help,
> Vanderghast, Access MVP
>
>
>
> "Chris E." <ChrisE@discussions.microsoft.com> wrote in message
> news:40336592-F82A-42F4-AD0C-587164B45C98@microsoft.com...
> > Let's say I want to count the number of order lines for every order. So I
> > have an order that has 6 lines on it. I want to count the order as a
> > unique
> > identity but count all six lines so the query would return
> >
> > countofORDERS = 1
> > countofLINES = 6
> >
> > but what is happening is this
> >
> > countofORDERS = 6
> > countofLINES = 6
> >
> > It's counting the order # 6 times even though it's the same number.
> > is there such thing as a count distinct or something similiar? I could
> > not
> > find one.
>
>
>
- Next message: anonymous_at_discussions.microsoft.com: "track rent"
- Previous message: SHIPP: "Re: Union query duplicates"
- In reply to: Michel Walsh: "Re: Simple count query not so simple..."
- Next in thread: Michel Walsh: "Re: Simple count query not so simple..."
- Reply: Michel Walsh: "Re: Simple count query not so simple..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|