Go Back   DeveloperBarn Forums > Databases > SQL Development

Sponsored Links

Discuss "count problem" in the SQL Development forum.

SQL Development - Structured Query Language (SQL) is the talk of databases. Discuss topics such as joins, triggers and other advanced SQL topics.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1  
Old September 7th, 2008, 12:24 PM
Barn Frequenter

 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default count problem

Hi,
I have this query i am trying to find out how many students registered having a student no.

If the student has a student no he will enter it in the status field

if he doesnt has a student no the field will be blank

I have this query but the count it gives me is not right

can someone tell me whats wrong with it

Code:
   strdist="SELECT DISTINCT Registration.Country, COUNT(Registration.Country) AS [count]FROM Registration INNER JOIN Registration_Tracking ON Registration.Email = Registration_Tracking.Email WHERE  Registration_Tracking.Status Is Not Null  and (Registration_Tracking.Type = 'Arts')GROUP BY Registration.Country order by Country"


todd
Reply With Quote
Sponsored Links
  #2  
Old September 7th, 2008, 02:07 PM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 820
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

Default

If using SQL Server you can do the following: SQL COUNT DISTINCT Function
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

Join our Folding team: DeveloperBarn Folding
Reply With Quote
Reply

  DeveloperBarn Forums > Databases > SQL Development

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
count and distinct problem todd2006 SQL Development 18 August 1st, 2008 09:20 AM


All times are GMT -4. The time now is 07:33 PM.



Content Relevant URLs by vBSEO 3.2.0