pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Deleting in order from a table
2+ messages / 2 participants
[nested] [flat]

* Deleting in order from a table
@ 2003-01-05 09:26  pginfo <pginfo@t1.unisoftbg.com>
  0 siblings, 1 reply; 2+ messages in thread

From: pginfo @ 2003-01-05 09:26 UTC (permalink / raw)
  To: pgsql-sql

Hi ,

I think the question is stupied, but it is importand for me.

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.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Deleting in order from a table
@ 2003-01-05 12:18  Ludwig Lim <lud_nowhere_man@yahoo.com>
  parent: pginfo <pginfo@t1.unisoftbg.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Ludwig Lim @ 2003-01-05 12:18 UTC (permalink / raw)
  To: pginfo <pginfo@t1.unisoftbg.com>; +Cc: pgsql-sql


--- 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-01-05 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-05 09:26 Deleting in order from a table pginfo <pginfo@t1.unisoftbg.com>
2003-01-05 12:18 ` Ludwig Lim <lud_nowhere_man@yahoo.com>

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