Bir sonraki satır güncellemek için mysql sorgusu

0 Cevap php

Ben aşağıdaki gibi bir günlük haber-ucu ve benim tablo yapısını göstermek gerekir.

| id  |  ndate      |News Tip |
+------+----------------------+
| 1541 | NULL       | news1   |
| 1545 | 14-10-2010 | news2   | 
| 1567 | NULL       | news3   |
| 1568 | NULL       | news4   |
| 1582 | NULL       | news5   |
     ....     ....      
| 1702 | NULL       | news217 |

ve sorgu select * from newstip where ndate!=NULL ve çekler nTarih ok geçerli tarihi maçlar olsun. değilse ben NULL güncel tarih ve tüm diğerleri için (bu durumda 1567) sonraki satırı güncellemeniz gerekir.

id benzersiz ama not in sequence böylece sorgu mümkün değil altında.

update newstip set ndate='15-10-2010' where id=(id+1); //failure

Bu durumu nasıl çözmek için?. Ben bu sürece php kullanıyorum;

0 Cevap