Answer: The phrase you are referring to only occurs three times in the entire Bible. All these occurrences show up in the book of Daniel, the seventh chapter, in verses 9, 13 and 22. The "ancient" reference in verse 13 is most interesting.
I saw visions in the night and, behold, One like the Son of man came with the clouds of heaven, and came to the Ancient of Days . . . (Daniel 7:13, HBFV throughout)
Verse 13 refers to two distinct Beings. King David, more than three hundred years before Daniel wrote these words, spoke of these two individuals. He wrote, "The Lord said unto my Lord, 'Sit at My right hand until I make Your enemies as Your footstool'" (Psalm 110:1).
This verse in Psalm 110 references three people, although in English it is a bit confusing since the same word is used to reference two distinct individuals. There is David, who is the narrator. There is "the Lord" (Strong's Concordance #H3068) which in the Hebrew is the word Jehovah. Additionally, there is "my Lord" (Strong's #H113), which in the Hebrew is Adoni. The word Adoni means sovereign or master.
David's refers to ancient Being
Who is David's Lord ("my Lord") in Psalm 110 who serves "the Lord?" We find our answer in the New Testament. The focus of the first chapter in Hebrews is Christ and establishing the fact that he is the Savior of Man. The chapter uses the same verse found in Psalm 110 when it states, "God, Who spoke to the fathers at different times . . . has spoken to us in these last days by His Son (Jesus) . . . But unto which of the angels did He ever say, 'Sit at My right hand, until I make Your enemies a footstool for Your feet'?" (Hebrews 1:13).
Clearly, the "my Lord" of Psalm 110 was the Being who became Jesus Christ. Who, then, was the other Being who was Lord over David's Lord? It is the ancient of days, whom we refer to as God the Father. Christ himself testified to the fact that the Father was greater than or over him (John 10:29, 14:28).
Psalm 110 and Daniel 7 refer to the same two Beings in the Godhead. "My Lord" of Psalm 110 is the same as the "Son of man" in Daniel 7. Jesus is referred to as the "Son of Man" in more than eighty distinct verses in the four gospel accounts. The Lord (Jehovah), who is the first Being listed in the Psalm, is the same as Daniel's second Being he mentioned.
There is something else to note in the Bible regarding this Being. They show (among many other Bible verses) that the Godhead is currently composed of two and not three Beings. These two beings are God the Father (the Ancient of Days) and God the Son (Jesus Christ). Noticeably absence is any mention of a third entity called the "Holy Spirit." The Holy Spirit is not a person in the Godhead but the power by which the Father and the Son accomplish their will.