Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. SELECT P.ID, Name, Number, Location, COUNT(year(InterviewDate) AS InterviewNo, Year(InterviewDate) AS Year
  2. FROM Person AS P INNERJOIN Interview as I ON P.ID = I.ID
  3. GROUP BY P.ID, Name, Number, Location, Year(InteviewDate)
  4. HAVING COUNT(Year(InterviewDate)) > 1 AND Year(InterviewDate)='2013'
  5.  
  6. SELECT P.ID
  7. ,Name
  8. ,Number
  9. ,Location
  10. ,InterviewNo
  11. FROM Person P
  12. INNER JOIN
  13. (SELECT ID
  14. ,COUNT(1) AS InterviewNo
  15. FROM Interview
  16. WHERE Year(InterviewDate) = 2013
  17. GROUP BY ID
  18. HAVING COUNT(1)> 1) I ON P.ID=I.ID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement