1. If a person recited בּוֹרֵא פְּרִי הָעֵץ, “Who creates the fruit of the tree,” over a food whose correct blessing is בּוֹרֵא פְּרִי הָאֲדָמָה, “Who creates the fruit of the ground,” he did not discharge his obligation. But if he recited בּוֹרֵא פְּרִי הָאֲדָמָה, “Who creates the fruit of the ground,” over a food whose blessing is בּוֹרֵא פְּרִי הָעֵץ, “Who creates the fruit of the tree,” he did discharge his obligation, since a tree is also a product of the earth. (Shulchan Aruch and Mishnah Berurah OC 206)
2. If there was an assortment of produce in front of a person, some being fruit of the tree and some fruit of the earth, and the person recited בּוֹרֵא פְּרִי הָאֲדָמָה, “Who creates the fruit of the ground,” with the express intent to cover the fruit of the tree as well — he did discharge his obligation. Similarly, if a person recited the blessing of שֶׁהַכֹּל, “through Whose word everything came to be,” on an item of that blessing with the express intent to also cover an item whose blessing is Ha’eitz (fruit of the tree) or Ha’adamah (fruit of the ground) as well — he did discharge his obligation. Nevertheless, this should not be done in the first place; rather one should recite the appropriate blessing for each type of food. (ibid.)

