Re: how to make a query to find the company with large number of s
- From: "Michel Walsh" <vanderghast@VirusAreFunnierThanSpam>
- Date: Fri, 1 Jun 2007 09:56:57 -0400
Depends if you already have the count of transactions, or not, in the table.
If you have:
SELECT company
FROM tableName
GROUP BY company
HAVING LAST(numberOfTransaction) = (SELECT MAX(numberOfTransaction)
FROM
tableName)
or, even simpler:
SELECT TOP 1 company
FROM tableName
GROUP BY company
ORDER BY LAST(numberOfTransaction) DESC
If the number of transactions has to be computed as the number of rows, in
the table, then:
SELECT TOP 1 company
FROM tableName
GROUP BY company
GROUP BY COUNT(*) DESC
Hoping it may help,
Vanderghast, Access MVP
"ghost" <ghost@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:11221C31-ABA8-499C-B006-CCFF0DE00D3A@xxxxxxxxxxxxxxxx
hi,
i meant the company which has large number of transaction
"Jerry Whittle" wrote:
What do you mean by "which company has the large No. of selling"? Most
sales?
Largest dollar amounts? Most items? In other words, which field
determines
"large"?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
"ghost" wrote:
Hi
I have two tables, one for the companies' info and one for t selling
In the selling table there is data for customers, companies, prices
etc.
What I want to do is making a query to know which company has the large
No.
of selling.
Can any body help me plzzzz
.
- Prev by Date: Re: Conditional statement
- Next by Date: GROUP BY vs DISTINCT
- Previous by thread: Re: Conditional statement
- Next by thread: GROUP BY vs DISTINCT
- Index(es):
Relevant Pages
|