בְּהַצּוֹת֨וֹ ׀ אֶ֥ת אֲרַ֣ם נַהֲרַיִם֮ וְאֶת־אֲרַ֪ם צ֫וֹבָ֥ה וַיָּ֤שָׁב יוֹאָ֗ב וַיַּ֣ךְ אֶת־אֱד֣וֹם בְּגֵיא־מֶ֑לַח שְׁנֵ֖ים עָשָׂ֣ר אָֽלֶף׃
when he strove with Aram-naharaim and with Aram-zobah, and Joab returned, and smote of Edom in the Valley of Salt twelve thousand.
Rashi on Psalms
and Joab returned and smote of Edom, etc. [of] the eighteen thousand stated in Scripture (II Sam. 8:13, I Chron. 18:12), Abishai slew six thousand the first time, and Joab slew twelve thousand when he returned from battling Aram.
Rashi on Psalms
When he fought Heb. בהצותו, as (Num. 26:9): “when they quarreled (בהצותם) with the Lord,” that he fought with them because they aided the Ammonites.