Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Nathaniel Smith](https://uploads.teamtreehouse.com/production/profile-photos/104593/micro_profile.jpg)
Nathaniel Smith
19,671 PointsDoes any one know what I'm getting this. Mysql2::Error: Unknown column 'employees_projects.project_id' in 'where clause'
SELECT accounts
.* FROM accounts
INNER JOIN employees_projects
ON accounts
.id
= employees_projects
.employee_id
WHERE accounts
.type
IN ('Employee') AND employees_projects
.project_id
= 1
Mysql2::Error: Unknown column 'employees_projects.project_id' in 'where clause': SELECT accounts
.* FROM accounts
INNER JOIN employees_projects
ON accounts
.id
= employees_projects
.employee_id
WHERE accounts
.type
IN ('Employee') AND employees_projects
.project_id
= 1
ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'employees_projects.project_id' in 'where clause': SELECT accounts
.* FROM accounts
INNER JOIN employees_projects
ON accounts
.id
= employees_projects
.employee_id
WHERE accounts
.type
IN ('Employee') AND employees_projects
.project_id
= 1
1 Answer
![Brandon Barrette](https://uploads.teamtreehouse.com/production/profile-photos/98134/micro_image_copy.png)
Brandon Barrette
20,485 PointsSeems to be an error in one of your associations. (has_many :accounts, belongs_to :employee, etc)
The error seems to be here:
ON accounts.id = employees_projects.employee_id
Somehow the account_id is being set equal to the employee_id, which doesn't make sense. We would need to see more of your code to help you diagnose it further.