Hello,
I don't really know how to explain what I need but here is an example. Hope you can understand and can give me some tips.
I have a 5 records db.
ID shop_name cards pos_id
1 shop1 CA PS01
2 shop1 CA PS02
3 shop2 CF PS03
4 shop2 CA PS04
5 shop3 CF PS05
The actual db has around 5000 records and 12 fields but if I can sort it for this example is more the enough. Here is what I want to do: I want to see how many pos I have that accept CA cards. This is simple. How do I see how many shops I have that accept CA cards? The only thing I thought to do is to sort the db by shop name and the compare a record with the next one. Is this the only way? Will this method slow down the server a lot? There will be around 5 users performing reports like this on the 5000 records db. Thanks.
Counting in a MySQL DB
Moderator: General Moderators
-
andrei.mita
- Forum Commoner
- Posts: 65
- Joined: Sun May 08, 2005 4:06 am
- Location: Barlad/Romania
Code: Select all
SELECT count(distinct shop_name) FROM xyz WHERE cards='CA'-
andrei.mita
- Forum Commoner
- Posts: 65
- Joined: Sun May 08, 2005 4:06 am
- Location: Barlad/Romania