Re: max of sum

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

From: MGFoster (me_at_privacy.com)
Date: 08/06/04


Date: Fri, 06 Aug 2004 18:30:04 GMT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

SELECT TOP 1 CustomerName, SUM(Tickets) As Total_Tickets
FROM table_name
ORDER BY 2 DESC

"order by 2 desc" means sort the output of the 2nd column in the SELECT
clause in descending order.

See the Access Help article on the TOP predicate for more info.

-- 
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQRPOKYechKqOuFEgEQJ3ygCaAihw46nh4ydQNjmEKkEG2PGN+XcAoP8m
OcQAk0vc2jsIgu4vyFWVj9vK
=C4UW
-----END PGP SIGNATURE-----
Franky wrote:
> Hi all,
> i need to filter out the customer who bought most tickets in an access db. I 
> have a query that gives me the total sum for each customer. But i can't 
> filter out just the best customer.


Relevant Pages

  • Re: Filter: Multiple values in a cell
    ... columns as you need and then sort and/or filter based on that new column. ... > features by the customer name. ... one feature can be requested by multiple customers. ...
    (microsoft.public.excel.misc)
  • Re: Showing records in a Sub form based on TWO combo boxes on Main
    ... on my first Combo which is where I select the Customer. ... It is this value that i want to firstly filter my form on ... When I select "Air New Zealand" I immediately getting a Runtime Error 2448, ... Private Sub cboFilterCust_AfterUpdate ...
    (microsoft.public.access.forms)
  • Re: Strange behavior with views
    ... >> with customer data I can open a new form with orderlines by ... >> doubleclicking on the customer info in the grid. ... >> parameter as a filter so i use the following code: ... >> - all open items ...
    (microsoft.public.fox.vfp.forms)
  • Re: Please help with a serious issue
    ... but then another user also applies a different filter. ... >>User 1 selects customer 1. ... The credit card table is filtered to that ... >>Customer Shipping - Holds all possible shipping addresses for each client. ...
    (borland.public.delphi.database.ado)
  • Re: Showing records in a Sub form based on TWO combo boxes on Main
    ... So (Customer Number) has to be entered as ... It is this value that i want to firstly filter my form on ... Private Sub cboFilterCust_AfterUpdate ... the filter string from whichever comboare not blank. ...
    (microsoft.public.access.forms)