Re: last, first, etc

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If you want smallest or largest value, use MIN and MAX.

FIRST and LAST will get you the values contained in the 1st and last records
which is only useful in a limited set of circumstances.

>From JETsql Help:
FIRST and LAST "...simply return the value of a specified field in the
first or last record, respectively, of the result set returned by a query.
Because records are usually returned in no particular order (unless the
query includes an ORDER BY clause), the records returned by these functions
will be arbitrary."

HTH,
--
George Nicholson

Remove 'Junk' from return address.


"The Iconoclast" <iconoclast2@xxxxxxxxxxx> wrote in message
news:urDHXZezFHA.3660@xxxxxxxxxxxxxxxxxxxxxxx
> Greetings!
> I have a table with the following fields:
> Product Quantity Price Date
> A 75 2.50 09/01/2005
> A 35 3.50 10/03/2005
> B 20 1.75 10/01/2005
> C 10 3.00 09/01/2005
> etc.
>
> I am trying to formulate a query such that based on a specified date (say
> 09/15/2005) only the corresponding price for that particular product would
> show up (i.e., A - 75 - 2.50 and C - 10 - 3.00). if the date were
> 10/05/2005
> then the display would show (A - 110 - 3.50; B - 20 - 1.75; C - 10 -
> 3.00).
> I've tries using the LAST aggregate function in the QBE but the results
> get
> jumbled up.
>
> Please help me. Thank you in advance.
>
>


.



Relevant Pages

  • Re: GROUP BY and performance
    ... The script at the end of this message sets up the example. ... > Consider the following query: ... > are not in the GROUP BY or in an aggregate function. ... > is the optimal way to write such a query for SQL Server? ...
    (microsoft.public.sqlserver.programming)
  • Re: Query Expression help
    ... else in the query without assigning an aggregate function such as Sum, Avg, ... "John Spencer" wrote: ...
    (microsoft.public.access.queries)
  • Re: Difficult query?
    ... type of aggregate function. ... The query is only going to output one record for this Patient_ID because you ... in which case all you would have to do would be to specify ... >> FROM ENTRY ...
    (microsoft.public.access.queries)
  • Re: Aggregate function errors
    ... Ann Scharpf ... Avg/26 AS PctYrComplete ... fields in a Totals query can have one of 4 ... the calculation needs to incorporate an aggregate function. ...
    (microsoft.public.access.queries)
  • Re: Possible to pad a resultset if non existing values?
    ... The query works well against the OLAP cube, I get a string of 0s. ... The value expression for the textbox 'textbox8' uses an aggregate function ... How can I make my 0s be the same datatype as the ... > Deepak Puri ...
    (microsoft.public.sqlserver.olap)