Обсуждение: Deleting in order from a table

Поиск
Список
Период
Сортировка

Deleting in order from a table

От
pginfo
Дата:
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.



Re: Deleting in order from a table

От
Ludwig Lim
Дата:
--- 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