Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2015
    Posts
    1

    Unanswered: Compare avg of data in column of certain users against a another user

    I have data in the form of
    Code:
    trans user Month 
    100    1      1 
    102    2      1 
    103    3      1 
    100    1      2 
    103    2      2 
    103    3      2 
    104    1      3 
    104    2      3 
    101    3      3
    I would like to find the average for each Month for User 1 and 2 and compare to User 3 for the same month so ideally I want

    Code:
    Avgtrans   user3Trans   Month 
    101              103           1 
    101.5           103           2 
    104              101           3 
    etc
    Last edited by Frank Nicklin; 10-07-15 at 06:23.

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    seems to be you'd be looking for for the average(trans), along with the trans from 3 so maybe a case statement or a separate join to the same table along with a group by right? What have you got so far in the way of your SQL and what is it giving you?
    Dave

Tags for this Thread

Posting Permissions

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