Re: A question on SQL



On Mon, 20 Aug 2007 20:18:01 -0700, Wei-Meng
<Wei-Meng@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hello all:
Got a question on SQL to ask:

Say I have an Access database containing a table with the following fields
and records:

Model Serial
A 1234
A 2345
A 3456
B 9876
B 8765

What is the SQL statement to generate the following result:

Model Serial Qty
A 1234
A 2345
A 3456 3
B 9876
B 8765 2

I need to print the subtotal for each model only once for each unique model.
How does the SQL look like?

Thanks!

I would not *DO* this using a query; I'd do it using a Report. Reports have
very nice subtotaling tools, optional display, etc. - you're talking about a
data presentation problem (for which the Report is the appropriate tool)
rather than a data-analysis tool (where Queries shine).

John W. Vinson [MVP]
.



Relevant Pages

  • Re: Populating a list -- table structure?
    ... I had made a report already and figured out about adding the ... your responce below, but thanks to your help with SQL, I was able to get the ... It takes a summary from a select query and gives the ... KitID, long integer ...
    (microsoft.public.access.forms)
  • Re: SCAN.EXE - McAfee AntiVirus Software
    ... > | of network computers and have only report summaries sent to be via ... > | Virus Scan Report File ... > | application RemoteProcessLaunch. ...
    (microsoft.public.security.virus)
  • Re: Populating a list -- table structure?
    ... I don't mean to skip your responce below, but thanks to your help with SQL, I was able to get the query to pull the info the way I needed. ... I have one report complete, ... Queries (just shows the QBE grid for convenience -- ...
    (microsoft.public.access.forms)
  • Re: Populating a list -- learning Access
    ... It is kinda funny -- I started using databases in the early 80's with dBase and, for years, never knew that I knew SQL! ... If you are on a form or report, the most important property is the NAME, because that is how you refer to it in code. ... I don't mean to skip your responce below, but thanks to your help with SQL, I was able to get the query to pull the info the way I needed. ... Queries (just shows the QBE grid for convenience -- ...
    (microsoft.public.access.forms)
  • Re: Problems adding "All" to combo box
    ... SQL for each combo box is in a previous post). ... You have a report defined that is named AI Thru Hole Work Log_Operator ... of the report or form you want to filter ...
    (microsoft.public.access.formscoding)

Loading