Given a Page that has a Component A and Component A has been published to LIVE target. Later, the same component A has been modified and published again, this time, to Staging target.
We need to know which version of component A has been published to LIVE and which version of component A has been published to Staging. Is it possible to obtain the version of the component that has been published in each target?
What you are looking for is not possible OOTB. You can infer however this information using
PublishEngine.GetPublishInfo(IdentifiableObject item), which gives you back aICollection<PublishInfo>, which contains the Date when the item has been published.You can then combine this information with version info of the item, and identify (by looking at the Publish time vs version check-in time) the version used when publishing.
However, versions could be deleted, so this method is not guaranteed to give you back the right information.
I suggest you publish the version of your Page as CustomMeta (perhaps using something similar to MetaDataProcessor, part of the TDFramework, to create meta data on-the-fly). You can then interrogate the Content Delivery DB and retrieve this information.
Alternatively, for a CM-side solution, you can use the Event System and intercept the publishing action. Then it's up to you to store the version of the Page (e.g. Application Data might be a good candidate).