You seem to be trying to write SQL, but in SPL
I suggest starting here for how to change your approach – https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/SQLtoSplunk
That said, I believe this will get you toward your goal:
index=ndx sourcetype=srctp ip=* path=*
| fields path ip _time
| fields - _raw
| sort 0 path -_time +ip
| streamstats reset_on_change=true current=true latest(_time) as tick by path ip
| eval tick=strftime(tick,"%c")
| stats count by path ip tick
| fields - count
from User warren – Stack Overflow https://stackoverflow.com/questions/74453969/splunk-query-to-find-previous-requests-from-different-ip/74464172#74464172
via IFTTT