Hi,
I have a mysql table that consists of orders made online. Every customer that orders products is inserted into this table.
How can i count how many orders a particular customer has made?
Thanks.
record count
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: record count
aceconcepts wrote:Hi,
I have a mysql table that consists of orders made online. Every customer that orders products is inserted into this table.
How can i count how many orders a particular customer has made?
Thanks.
Code: Select all
"SELECT COUNT(*) as orders_made GROUP BY customer_id"- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
if you are already fetching all your results from a previous query, such as
then you can simply use mysql_num_rows(), otherwise use jmut's suggestion
Code: Select all
SELECT * FROM `orders` WHERE `customer_id` = 5