Helen M Hudson ha scritto:
> So, if my table structure was:
> id | date   | order_ref | amount
> 1  | 1/1/01 | 100       | 1000 << these 2 are the rows
> 2  | 1/1/01 | 100       | 200  << i want to exclude
> 3  | 2/1/01 | 100       | 1000
> 4  | 2/1/01 | 100       | 200
> 5  | 2/1/01 | 100       | 50
>
> I'd like to end up with
> latest_date_on_order | order_ref | sum(amount)
> 2/1/01               | 100       | 1250
>
> I know its a one-liner for someone who has reached the light... so any help 
> very much appreciated!
>   


I do not know if i can give you the light because my english is not as
good as I'd like.
If i've understood your question, you can try this SQL statement:

SELECT max( `date` ) AS 'date', sum( `amount` ) AS 'amount'
FROM `Prova`
WHERE `order` =100
GROUP BY `order`
LIMIT 0 , 30


Enjoy and please tell me if it solves your problem...

-- 
vittorio zuccalà
Finconsumo Banca SPA
[EMAIL PROTECTED]
Tel: 011-6319464


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to