By which standard? This is the old “don’t end a sentence with a preposition” adage. In daily speech and informal writing we do it all the time, so it’s grammatical by those standards. By other (very formal) standards the second way is considered “correct.” Take your pick.
And before anyone trots out the quote which is commonly attributed to Winston Churchill regarding this, I’d just point out that it actually is mistaken, because–the way it’s typically phrased–it conflates prepositions with phrasal verb particles.
In fact, I believe the reason English behaves this way is precisely because of phrasal verbs. The word in in alpha’s quote is not a particle of a phrasal verb, but it “masquerades” as one, in that it wants to stick to the verb sit, rather than be front-loaded in the clause. I suggest this is the influence of phrasal verbs, (though I don’t know how it could be "proved), because other languages don’t do this, as far as I know.
The more interesting question is what the word “correct” really means.
When a grammatical question like this comes up, descriptivist linguists will point out that we end sentences with a proposition all the time, noting examples in formal contexts, in widely acknowledged great literature, in the writing of the person advocating the adage, etc. - and therefore conclude that the “rule” is nonsense. Language is defined only by empirical rules, and there is no empirical rule in English that you can’t put a preposition at the end of a sentence. Somebody with poor observational skills pulled this “rule” out of their ass at some point in history, and it somehow gained traction like a meme.
Prescriptivists will then counter with: you descriptivists seem to be saying that anything goes, that just because a native speaker says or writes something, then it’s automatically valid and okay. That can’t be right - it seems like linguistic anarchy. Surely there must be rules.
And of course there are rules, it’s just that this is not a rule. Take another trivial rearrangement of the words in that sentence, for example:
Every native speaker of any dialect of English agrees that this word order is wrong. So that is clearly a rule of English. And in fact, out of all the possible rearrangements of the word order in that sentence, 99% of them are universally agreed to be wrong by all native speakers. So there are many strict rules for making a grammatically correct sentence English, and all these rules are universally acknowledged and unconsciously followed flawlessly by all English speakers. But there is never much cause to discuss them, because it’s so obvious to all of us what’s right and what’s wrong.
When a purported rule is actually brought up for explicit discussion with a question like - “grammar experts, tell me which is correct!” - well, you can predict that with high probability there is no strict rule for what’s under consideration, it’s unlikely that either form is definitively “wrong”. Both variants must be prevalent in the language to some degree, otherwise the question of which is correct simply wouldn’t arise (unless a non-native speaker were asking). So it’s unlikely that there will be a valid response that only one form is definitively correct. The likely conclusion might be that only one form was historically correct, but the language has changed; or that they are differences among dialects; or that one is stylistically preferred in certain contexts, a question of register.
Either form is fine grammatically. If you want to sound more informal and colloquial, go with the first. If you want to be formal, go with the second. The idea that you can’t end a sentence with a preposition in English is mostly grammatical superstition. Sometimes moving it from the end of the sentence will aid in clarity. Most of the time, in my experience, it doesn’t make a whit of difference and, frankly, changing it to the more formal construction makes it sound stilted and uneuphonious to me.
Trees the shade of which is never sat upon by those whose actions were causative of the planting thereof are causative of an increase in the greatness of societies that contain them therein.
True–and while your explanation to that question is probably the best we’ve had in while–it almost always comes down to someone saying the same thing, just not so well.
So for me, a truly more interesting question is the specifics of this particular case. Why does English have this tendency to avoid front-loading prepositions with these subordinate clauses, when just about every other language with similar grammatical origins sticks to it?