General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 15th, 2003, 05:42 AM
PHP041 PHP041 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Turkey
Posts: 10 PHP041 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to PHP041
Exclamation Counting the same ID

you will see my table defination below. How could I count the same events as 1. I am trying to do that count and group by I got the answers that I dont want. In the table script must count eventID 1 as 1 event eventID 2 as 1 and eventID 3 as 1. Total events of 3 . Anay suggestions please?

Best regards

mysql> select eventID, reportID from reports;
+---------+----------+
| eventID | reportID |
+---------+----------+
| 1 | 1 |
| 1 | 2 |
| 3 | 3 |
| 1 | 4 |
| 2 | 5 |
| 3 | 6 |
+---------+----------+
6 rows in set (0.13 sec)

Reply With Quote
  #2  
Old October 15th, 2003, 08:02 AM
laurencewilks laurencewilks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 1 laurencewilks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Try

SELECT count(DISTINCT `eventID`) FROM `reports`;

L

Reply With Quote
  #3  
Old October 16th, 2003, 02:00 AM
PHP041 PHP041 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Turkey
Posts: 10 PHP041 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to PHP041
Thats all

Thank you that solved my problem

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Counting the same ID


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT