+ Reply to Thread
Results 1 to 2 of 2

Thread: Count problem

  1. #1
    Barn Loyal todd2006 is an unknown quantity at this point todd2006's Avatar
    Join Date
    Mar 2008
    Posts
    889
    Rep Power
    4

    Count problem

    Hi,

    I have 2 tables

    codes
    StudentMembers

    In codes the table design is like this
    Code:
    Id
    PromoCode
    Price
    
    In StudentMembers the table design is like this
    Code:
    Id
    Name
    Code
    Price
    DateSigned
    
    What I want to do is display ow many students used what code so my query is like this
    Code:
    Select Count(Code), PromoCode from Codes, StudentMembers where Codes.PromoCode=StudentMembers.Code
    
    the query is not working

    any idea

    todd

  2. #2
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    What do you mean by it's not working? Does it give any errors?

    I would have thought something like this should work:-
    Code:
    Select Count(A.Id) AS NumberofStudents, A.PromoCode from StudentMembers A GROUP BY A.PromoCode
    

+ Reply to Thread

Similar Threads

  1. Retrieving Count with SRSS
    By murray002 in forum SQL Server Reporting Services Help
    Replies: 9
    Last Post: July 16th, 2010, 10:56 AM
  2. Count problem
    By todd2006 in forum SQL Development
    Replies: 3
    Last Post: April 29th, 2009, 02:51 PM
  3. New Post Count Ranks
    By jmurrayhead in forum Announcements
    Replies: 0
    Last Post: September 28th, 2008, 06:11 PM
  4. SQL Count Distinct
    By todd2006 in forum SQL Development
    Replies: 1
    Last Post: September 7th, 2008, 03:07 PM
  5. count and distinct problem
    By todd2006 in forum SQL Development
    Replies: 18
    Last Post: August 1st, 2008, 10:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO