yii2 : attribute being taken as string

I am trying to execute this code


But this takes b.id as a string to compare with directly instead of comparing it as a table attribute.

Any ideas on how to fix this. I am new to yii2.

please don’t post duplicate posts you asked the same question in your other post I have replied to your post.