Help with relations - Error: Unknown column in 'where clause'
When I try run this query to fetch all 'test' records along with the users that created each record, I get the following error:
Here are the schemas for testTable and usersTable:
The issue seems to be because the generated SQL query contains a subquery that references a table in the outer query. Any ideas would be appreciated.
5 Replies
You defined userRelations twice
id column on userTable is char createdBy is varchar
Good catch. I've fixed those issues but I'm still getting the same error
So what is schema now?
repost please
And just to be sure you have pushed/migrated these changes to you db
The original post has been updated with the corrected schemas
Here is the raw SQL generated by the query. Executing the SQL directly on the database results in the same error
@Bryce try providing the same value for
relationName
field on both many
and one
functions like this:
generate and apply the migration and then try again