Find equal rows from table

I have a number of row base on plan and plan detail, I want to find out the same row set with other detail like plan 1 has 3 rows of data in detail table so need to find out the same rows for another plan. I have some sample data with this post may be more helpful to understand my problem. below is the Sample data Image, iwan to group by the record but not on a single row base on the full row set base on PlanId, MinCount, MaxCount and CurrencyId

my expected data is below
Epected

I had tried to do with Some lengthy process like append all data in a single row and compare with other data, but it seems very lengthy process and takes to much time for 100 records I have an approx 20000 records in an actual database so not a good solution, please suggest me some thought

Something like:

with x as
(
select 1 as plandetailid, 1 as planid,1 as staircount,1 as mincount, 5 as maxcount,1 as accountid, 1 as currencyid
union all select 2,1,2,6,999,1,1
union all select 10,1,2,6,999,4,1
)
select 
	planid,
	staircount,
	mincount,
	maxcount,
	currencyid,
	(Select Stuff((
		Select
			',' + cast(accountid As VarChar(10))
		From x As X2
		Where X1.planid = X2.planid
			And X1.staircount = X2.staircount
			And X1.mincount = X2.mincount
			And X1.maxcount = X2.maxcount
			And X1.currencyid = X2.currencyid
		Order By accountid
		For XML Path('')
	), 1, 1, '')) As AccountID

from x as X1
group by 
	planid,
	staircount,
	mincount,
	maxcount,
	currencyid

It would be easier to be sure if you posted DDL rather than just an image of your data, which isn't particularly usable.