Salih bin Khawat reported,

Someone who prayed the prayer of fear with the Prophet ﷺ on the day of Dhat ar-Riqa reported that one group lined up with him while another group stood facing the enemy. He prayed one rakah with those who were with him, then remained standing while they completed their prayer on their own. They then withdrew and took position facing the enemy, and the other group came forward.He prayed with them the remaining rakah, then remained seated while they completed their prayer on their own, after which he gave the closing salam with them.

Azami 2903

Sahih

عن صالح بن خوات

عمن صلى مع النبي ﷺ يوم ذات الرقاع، صلاة الخوف، أن طائفة صفت معه، وطائفة وجاه العدو، فصلى بالذين معه ركعة ثم ثبت قائما وأتموا لأنفسهم، ثم انصرفوا فصقوا وجاء العدو، وجاءت الطائفة الأخرى فصلى بهم الركعة التي بقيت، ثم ثبت جالسا، وأتموا لأنفسهم، ثم سلم بهم.

الأعظمي 2903صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Prayer of fear
Section
Imam praying one rakat with each group, then giving salutations, and each group completing one rakat on their own
Numbering
Jami al-Kamil 2903 (2nd edition)
Azami 2903