sum query

Results 1 to 2 of 2

Thread: sum query

  1. #1
    Join Date
    Dec 1969

    Default sum query

    I have two tables <BR>sessions (sessionID, description)<BR> 1 session a<BR> 2 session b<BR> 3 session c <BR> 4 session d<BR> <BR>sessions booked(userID, sessionID)<BR> 101 1<BR> 101 4<BR> 102 1<BR> 102 3<BR> 102 4<BR><BR>I would like to know how to build a query to display the total number of sessions booked for each sesssion.<BR>i.e. session a 2<BR> session b 0<BR> session c 1<BR> session d 2<BR> <BR>Could any one helkp me?<BR><BR>Thanks<BR><BR>Chris

  2. #2
    Join Date
    Dec 1969

    Default RE: sum query

    Something along the lines of:<BR><BR>SELECT description, COUNT(userid)<BR>FROM [sessions booked] b<BR>INNER JOIN sessions s ON s.sessionid = b.sessionid<BR>GROUP BY sessionid, description<BR><BR>Dunc

Posting Permissions

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