Re: Deleting in order from a table - Mailing list pgsql-sql

From Ludwig Lim
Subject Re: Deleting in order from a table
Date
Msg-id 20030105121837.20686.qmail@web80304.mail.yahoo.com
Whole thread Raw
In response to Deleting in order from a table  (pginfo <pginfo@t1.unisoftbg.com>)
List 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
LIMITn 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


pgsql-sql by date:

Previous
From: "Peter Galbavy"
Date:
Subject: weighting (the results of) a query ?
Next
From: Cédric Dufour (public)
Date:
Subject: Grant execute on functions; related objects permissions ?