ms access - SQL query to select people interviewed more than once in a year -


first of query done in access, i'm trying find details of people have been interviewed more once in specific year. needs multi tabled, both sort out people have been interviewed more once in 2013, , details of people.

example

tables follows:

interview

| id | interviewdate |

| 123| 13-12-04 |
| 789| 14-01-10|
| 123| 13-12-21 |

person

| id | name | number | location |

| 123| john| 128231 | usa
| 789| max | 123556 | europe

so list bit larger, ideally want able make query count had interview more once in 2013 , details table.

i have query apparently works i'm sure there's better way show may have flaws.

select p.id, name, number, location, count(year(interviewdate) interviewno, year(interviewdate) year person p innerjoin interview on p.id = i.id group p.id, name, number, location, year(inteviewdate) having count(year(interviewdate)) > 1 , year(interviewdate)='2013' 

i feel year(interviewdate) wrong, able same result without using exact phrase? maybe using sub-query.

thank you.

my access syntax little off, think asking fro like:

select p.id       ,name       ,number       ,location       ,interviewno   person p         inner join         (select id               ,count(1) interviewno           interview           year(interviewdate) = 2013          group id         having count(1)> 1) on p.id=i.id 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -