pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ludwig Lim <lud_nowhere_man@yahoo.com>
To: pginfo <pginfo@t1.unisoftbg.com>
Cc: PostgreSQL Mailing List <pgsql-sql@postgresql.org>
Subject: Re: Deleting in order from a table
Date: Sun, 5 Jan 2003 04:18:37 -0800 (PST)
Message-ID: <20030105121837.20686.qmail@web80304.mail.yahoo.com> (raw)
In-Reply-To: <3E17FA4B.7F4102B6@t1.unisoftbg.com>


--- pginfo <pginfo@t1.unisoftbg.com> wrote:
> I have a table tableA ( ....,order_num int).
> 
> I will to delete some records from tableA but in asc
> or desc
> order_num-order.
> 
> Is it possible to write delete from tableA where
> (some conditions) order
> by order_num ?
> 
> Many thanks,
> ivan.
> 

Try the following:

   DELETE
   FROM tableA
   WHERE order_num IN (
        SELECT order_num
        FROM tableA
        ORDER BY order_num
        LIMIT n OFFSET m);  

 Use LIMIT to determine the number of rows to delete
and OFFSET to determine the "starting row".

ludwig


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com



view thread (2+ messages)

Message-ID: <20030105121837.20686.qmail@web80304.mail.yahoo.com>
Permalink:  ../20030105121837.20686.qmail@web80304.mail.yahoo.com/
Also on:    postgresql.org/message-id/20030105121837.20686.qmail@web80304.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lud_nowhere_man@yahoo.com, pginfo@t1.unisoftbg.com
  Subject: Re: Deleting in order from a table
  In-Reply-To: <20030105121837.20686.qmail@web80304.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox