If you have the subordinate clause before the main clause, you write a comma. However, the rules are a bit different for relative pronouns connecting main and subordinate clause.
6.7m questions
8.9m answers