Here’s a curious construction it’s worth understanding. Is it correct to write he said that that was what he was told? The word that has at least four different uses in English, and the duplication of it in this example will help us sort out some of its uses and review how to analyze a sentence.
Let’s remember first that an English sentence unfolds from left to right, which means that after our eye catches something unusual, we are often best served in our analysis by backing up, by returning to the beginning of the sentence. Words work in context, and much of the ambiguity they present at times can be clarified by seeing how they are functioning with the words around them. And when we then return to where the sentence began, we should look first for clauses, those groups of words that pair a subject with a verb.
So in our example, the first clause we see is he said. This simple observation gives us material help, because the nature of the verb said will aid in sorting out the meaning of the first instance of that in the sentence. Said is not only a transitive verb, but a transitive verb of indirect statement. The writer is reporting what the grammatical subject, he, said; that grammatical subject is not himself saying anything directly in the sentence. So what, then, is the direct object of the transitive verb said? The entire clause (and remainder of the sentence) that that was what he was told. This group of words is a clause in its own right, and to say that it functions as a direct object means that it must be a noun of some sort, because objects are things and things are nouns. And when a noun appears in the form of a clause, it very often begins with the subordinating conjunction that. So the first that in the phrase that that is a subordinating conjunction, and the clause it begins, that that was what he was told, is called, appropriately enough, a noun clause.
But why would the writer duplicate the word that? Because the second instance is not another subordinating conjunction, but a demonstrative pronoun. Pronouns name or refer to something indirectly, and demonstrative pronouns show or point or refer to something without naming it again. So we can assume that somewhere earlier in the larger paragraph of which our sentence was a part, the writer made some reference to exactly what it was the subject he was told—let’s imagine that a colleague at work was promoted to a higher position. That would be, then, the information, the noun unstated in our sentence, to which the demonstrative pronoun that is referring. This pronoun then takes its own stand as the grammatical subject of the verb was, the principal verb of the larger noun clause which is the direct object of the verb said in the opening clause.
And so the sentence unfolds. But could the writer have removed one of the that’s? The first one, yes, the second one, no. The that which remains in the revision he said that was what he was told is the demonstrative pronoun, not the subordinating conjunction, and we know this not only because the verb was needs a subject (and conjunctions cannot be subjects), but also because it is regular and usual in standard English to omit the subordinating conjunction that. This omission of words which we expect the reader to easily supply is called ellipsis, and ellipsis is especially common in more casual writing. Deciding whether to include or delete a word depends on context and purpose, and including the conjunction here allows for a little more emphasis to be put on the following pronoun. Without it, that pronoun would have to be doing double duty, its identity to the conjunction suggesting the conjunctive force as well.
The lesson here is to proceed as methodically as possible in analyzing a sentence. Were we to continue in our orderly examination, we would discover that the subordinate noun clause itself has another clause within it, what he was told, and that that would reveal that we have three levels of discourse in this common-sounding but not-so-simple statement. (And if you want a little more practice, you might analyze the last sentence I just wrote, with the same that that construction and a few more that’s to boot.) Sentences, like rivers, are meant to flow, and the point of analysis is to remove what obstacles may have fallen into the stream so that our readers may sail on their way.