删除数据FIFO方法 [英] delete data FIFO method

查看:508
本文介绍了删除数据FIFO方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用FIRST IN FIRST OUT(FIFO)方法从表中删除数据。我有日期和ID。

使用C#和SQL2008。

how do i delete a data from table using FIRST IN FIRST OUT (FIFO) method.i have date and ID.
using C# and SQL2008.

推荐答案

你自己很困惑!根据评论,您可以根据日期字段或ID字段进行简单删除。



假设您以增量顺序插入记录中的任何一个日期/ ID列,您可以轻松删除第一条记录。



如果您没有在任何字段中以增量顺序插入数据,则应该在表中添加IDENTITY列并根据此值删除数据身份表。



希望这会有所帮助!
You are confusing yourself! As per comments made you can do a simple delete based on either Date field or ID field.

Assuming you are inserting the records in incremental order for either of the date /ID columns, you can delete the 1st record easily.

In case you are not inserting data in incremental order in any of the fields, you should add a IDENTITY column to your table and delete data based on the value of this identity table.

Hope this helps!


引用:首先包括我的应用程序我在月初添加一些项目。所以我想在同一个月的最后一个删除添加的项目。(我想先删除第一个添加的项目。)这就是为什么要问如何使用FIFO方法删除项目..

thnx ..



然后你的表中似乎需要一个包含记录添加日期的列。

你可以删除记录在你的WHERE子句中指定这个列(不能真正给出一个精确的SQL语句,因为你的要求对我来说似乎有点模糊)。



从这里开始来如果你在途中遇到问题,请回来。
QUOTE: include my application first i add some items in beginning of the month.so i want to remove added item in last of the same month.(i want to firstly remove first added items).so that's why asked how to delete items using FIFO method..
thnx..

Then it seems that you need, in your table, a column holding the date the record was added.
And you can delete the records with specifying this column in your WHERE clause (cannot really give a precise SQL statement as your requirement still seems a little bit obscure to me).

Start from here and come back if you have problems along the way.


这篇关于删除数据FIFO方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆