Narrated 'Abdullah bin Zaid: The Prophet said, "But for the emigration, I would have been one of the Ansar; and if the people took their way in a valley (or a mountain pass), I would take Ansar's valley or their mountain pass."
— Sahih Bukhari, Volume 9, Book 90: Wishes, Hadith #351
Narrated 'Abdullah bin Zaid: The Prophet said, "But for the emigration, I would have been one of the Ansar; and if the people took their way in a valley (or a mountain pass), I would take Ansar's valley or their mountain pass."
This hadith is from the book of Wishes in Sahih Bukhari, compiled by Imam al-Bukhari. It is hadith number 351 in book 90 of volume 9.