can you please explain your full scenario?

Please attach sample data in xlsx format

which verison of SQL do you use?