You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATETABLEIF NOT EXISTS person(id integer , email text);
INSERT INTO person VALUES (1,'abc@gmail.com'),
(2,'abc@gmail.com'),
(3,'apple@gail.com');
WITH cte AS
(
SELECT email, ROW_NUMBER () over(PARTITION BY email) AS row_no FROM person
)DELETEFROM person USING cte WHERE row_no>1;
SELECT*FROM person ;
this code should only delete the rows with row_no value grater than 1 but it is deleting all the rows from a table ,how and why?
I checked with different row_no values like grater than 2 or 3 then it's working as expected not deleting a single row as no row_number grater than 2 or 3 but as soon as it is hitting 1 it is deleting all the rows
The text was updated successfully, but these errors were encountered:
this code should only delete the rows with row_no value grater than 1 but it is deleting all the rows from a table ,how and why?
I checked with different row_no values like grater than 2 or 3 then it's working as expected not deleting a single row as no row_number grater than 2 or 3 but as soon as it is hitting 1 it is deleting all the rows
The text was updated successfully, but these errors were encountered: