A wall only "works" to slow down crossers enough for border control to intervene.
But that's somewhat theoretical as we've seen people get over that wall pretty quickly. If you actually start deporting everyone instead of "catch and release", then the influx will finally slow, at least.
Trump did have the right idea with engaging Mexico to stop them at their southern border, which would be easier to secure. But you probably have to write them a check (instead of the other way around, as Trump insisted). Still, that would probably be much more cost effective when you consider the cost of enforcement combined with the cost incurred to support the migrants.