This mostly means you have extra repos active, since no package exists twice in the distro itself. As long as you don’t tell zypper which version should be used, either by setting priorities, or by using a vendor-change to the repo(s) involved, it cannot know which version you want to use.
Please show an example and show
I’m not aware of a way to make a specific selection, only to implement the default option (typically option 1) by running completely unattended.
Personally, I haven’t found myself in a situation where I’d want to do anything other than to upgrade to latest available from any repo so although I’ve run into this I haven’t thought twice about what happens by default.
If you wanted to not upgrade/update the package, then you could create a lock on the old package (If necessary write into your script) to prevent the upgrade.
The remaining option to skip is a somewhat odd choice in an unattended install, but seems to be the remaining option that can’t be addressed.
Of course, your tries wouldn’t work…
zypper in -f
forces the re-install, which incidentally will also restore the default configuration, wiping out your User config (A regular install or update retains the User config)
zypper -n in
is one of the ways to do an unattended install, has no options to configure further