Hi
I need help on a SQL query...
Suppose I have a db with three fields...
1. ID
2. CellNumber
3. Transaction
I need a query to return the number of specific transactions per cellnumber. i.e... if the data were as follows :
1 0821234567 SMS
2 0821234567 MMS
3 0821234567 SMS
4 0821234567 SMS
I need the query to return the following :
1 0821234567 SMS 3
2 0821234567 MMS 1
SQL query
-
- Registered User
- Posts: 716
- Joined: 08 Oct 2004, 02:00
- Contact:
- rustypup
- Registered User
- Posts: 8872
- Joined: 13 Dec 2004, 02:00
- Location: nullus pixius demonica
- Contact:
Code: Select all
SELECT MyTable.CellNumber, MyTable.Transaction, COUNT(MyTable.Transaction) FROM MyDb.ownr.MyTable WHERE (some_clause) GROUP BY MyTable.CellNumber, MyTable.Transaction ORDER BY MyTable.CellNumber, MyTable.Transaction
Most people would sooner die than think; in fact, they do so - Bertrand Russel
-
- Registered User
- Posts: 716
- Joined: 08 Oct 2004, 02:00
- Contact:
-
- Registered User
- Posts: 716
- Joined: 08 Oct 2004, 02:00
- Contact: