Re: how to make a query to find the company with large number of s

Tech-Archive recommends: Fix windows errors by optimizing your registry



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



.



Relevant Pages

  • Re: total query with last date
    ... ID PersonID Date Amount and Type ... FROM tablename AS X ... transactions on stacks of paper, and you wanted the most recent transaction, ... LastOfEDate, LastAS LastOfCampaignID, ...
    (microsoft.public.access.queries)
  • Re: total query with last date
    ... ID PersonID Date Amount and Type ... FROM tablename AS X ... transactions on stacks of paper, and you wanted the most recent transaction, ... and you found two sheets of paper saying June 18 - which of those two is "the ...
    (microsoft.public.access.queries)
  • grid heiracheal display
    ... My grid comes up with three hyperlinks: TableName, transactions, transactionrecord ...
    (microsoft.public.dotnet.languages.vb)
  • grid heiracheal display
    ... My grid comes up with three hyperlinks: TableName, transactions, transactionrecord ...
    (microsoft.public.dotnet.languages.csharp)