4788. And the Midianites sold him into Egypt. That this signifies that those who are in some truth of simple good consulted memory-knowledges is evident from the representation of the Midianites, as being those who are in the truth of simple good (n. 3242, 4756); and from the signification of "Egypt," as being memory-knowledges (n. 1164, 1165, 1186, 1462, 2588, 4749); and from the signification of "selling," as being to alienate (n. 4752, 4758); and from the representation of Joseph, as being Divine truth. When this is said to be sold or alienated by those who are in the truth of simple good to memory-knowledges, which are "Egypt," it denotes that they consulted them; for those who are in the truth of simple good suffer themselves to be very much led away by the fallacies of the senses, and thus by memory-knowledges, which are therefrom.
 It was said above (verse 28) that Joseph was drawn out of the pit by the Midianites, but that he was sold to the Ishmaelites; whence it might seem that he could have been sold in Egypt only by the Ishmaelites. But the reason why he was not sold by the Ishmaelites but by the Midianites, is that the Ishmaelites represent those who are in simple good (n. 4747), and the Midianites those who are in the truth of this good. Joseph, or the Divine truth, could not be sold by those who are in good, but only by those who are in truth; for those who are in good know from good what Divine truth is, but not so those who are in truth.
 The men of the church are distinguished into two kinds - those who are in good, and those who are in truth. Those who are in good are called celestial, but those who are in truth are called spiritual. Between these two kinds there is a great difference. Those who are in good are in the affection of doing good for the sake of good, and without recompense from others; for it is recompense to them to be permitted to do good, since in so doing they perceive joy; but those who are in truth are in the affection of doing good, not for its own sake, but because it is so commanded, and for the most part they think of recompense; their joy is from this, and also from glorying.
 From this it is evident that those who do good from good, do it from internal affection; while those who do good from truth, do it from some external affection. Hence the difference is evident, namely, that the former are internal men, and the latter external. Those therefore who are internal men cannot sell, that is, alienate, the Divine truth which is represented by Joseph, because they perceive truth from good; and hence neither the fallacies of the senses, nor consequently memory-knowledges, lead them away. But those who are external men can sell or alienate it, because they do not perceive truth from good, but only know it from doctrine and teachers; and if they consult memory-knowledges, they suffer themselves to be easily led away by fallacies, for they have no inward dictate. It is for this reason that Joseph was not sold by the Ishmaelites, but by the Midianites.