I must create migration to update question image attribute but i need to check some attributes from other tables, my schema looks like this:
question {
id,
name,
groupId,
imageUrl -> i need to update this
}
group {
id,
name,
quizId
}
quiz {
id,
name,
type -> where type is 'History'
}
And i need to update attribute imageUrl from table question WHERE quiz type is for example 'History', i'm not sure how i can join this tables when using UPDATE. I tried something like this but it's not working like i want.
UPDATE question SET image_url = 'pathToImage' FROM quiz q WHERE q.type = 'History'