It's completely possible to enter different frequent flyer numbers into a PNR such that specific segments (even specific passengers, if more than one) earn credit as desired.
Travel agents can do this in Sabre, can't imagine why it couldn't be done directly with the airlines.