I want to know, if I can perform such operation. I have following data arrangement in table:
id SessionId P_Name P_TypeId
1 abc XYZ 5
2 abc XYZ 5
3 abc XYZ 5
4 abc XYZ 5
5 abc XYZ 5
6 abc XYZ 5
7 abc XYZ 5
8 abc XYZ 5
Here I have 8 similar items, but have unique Ids.
Condition:
From frontend i will pass [P_TypeId] = 5 and the query will then remove only one item from the table using a delete statement. Is this possible?
Yes, for example using
ROW_NUMBER:Deletes the lowest id of each group.
DEMO