It pleased the Lord that Solomon had asked this. And God said to him, “Because you have asked this, and have not asked for yourself long life or riches or the life of your enemies, but have asked for yourself understanding to discern what is right,
1 Kings 3:10-11 (ESV)
He had 700 wives, who were princesses, and 300 concubines. And his wives turned away his heart. For when Solomon was old his wives turned away his heart after other gods, and his heart was not wholly true to the Lord his God, as was the heart of David his father.
1 Kings 11:3-4 (ESV)