Delete from table conditionally

From: Arup Rakshit <aruprakshit(at)rocketmail(dot)com>
To: Pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Delete from table conditionally
Date: 2016-12-17 07:39:28
Message-ID: 1586512452.4798452.1481960368113@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I am using Postgresql 9.5.

Below is the sample data taken from the mail table with only required columns:

id | question_id | answer_id | content
----+-------------+-----------+----------
2 | 25 | 270 | Arup
3 | 26 | 276 | Kajal
4 | 26 | 276 | Arup
5 | 27 | 280 | Kajal
6 | 25 | 270 | Arup
7 | 25 | 270 | Lalu
8 | 25 | 270 | Arup
9 | 26 | 274 | Dilip
10 | 25 | 270 | doli
11 | 25 | 270 | Arup
(10 rows)

Say, I know the id 6 where content is "Arup". Now from this row, I want to delete all next rows where the content is "Arup". How should I achieve this?

Regards,
Arup Rakshit

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Charles Clavadetscher 2016-12-17 07:49:43 Re: Delete from table conditionally
Previous Message Guyren Howe 2016-12-17 06:54:27 Re: [GENERAL] Love Your Database project — Thoughts on effectively handling constraints?