First of all you can collect all needed notes id.
I supposed to think what you already have relations between Note
and CirclesDream
note_ids = Note.where(circle_id: @circle.id).pluck(:id) # your first SELECT
dream_ids = CirclesDream.where(id: @circle.id).pluck(:note_id) # your second SELECT
notes_ids = note_ids | dreams_ids # combine them
notes = Note.where(id: notes_ids) # Now your
upd: I've just fixed typo. Changed id
to note_id
in second request