Re: How to sum the table records?
- From: "Rik" <luiheidsgoeroe@xxxxxxxxxxx>
- Date: Sun, 7 May 2006 11:33:21 +0200
Alex Murphy wrote:
Hi all,
I using the "list" function to extract the sales text delimited file
and insert into the table. How to find out the best sales item and
worst sales item?
Summing is easy:
SELECT `item`, SUM(`qty`) AS 'total_sold' FROM table_name GROUP BY `item`
Extracting best and worst in one query in one go is a little bit trickier.
I'm sure it's possible in one query, but I'm not familiar enough with JOINS
or subqueries to figure that one out.
That's more of a database question, which database are you using?
Grtz,
--
Rik Wasmus
.
- Follow-Ups:
- Re: How to sum the table records?
- From: Alex Murphy
- Re: How to sum the table records?
- References:
- How to sum the table records?
- From: Alex Murphy
- How to sum the table records?
- Prev by Date: Keep getting: php_network_getaddresses: getaddrinfo failed
- Next by Date: Unsubscribe script
- Previous by thread: How to sum the table records?
- Next by thread: Re: How to sum the table records?
- Index(es):
Relevant Pages
|