如何在 FoxPro 中修改或运行此查询?

发布于 2024-10-26 09:40:33 字数 208 浏览 1 评论 0原文

我有这样的 SQL 查询

   select * from tablename  where Fieldname not in (10005347797,1006009285)


我的目标是删除不在该 id 中的剩余记录。因此,在此之前我想查看该表中将要删除的所有记录。
如果您知道如何删除该记录,也可以给我删除命令。

I have the SQL query like this

   select * from tablename  where Fieldname not in (10005347797,1006009285)

My aim is to delete remaining records not in that id.So before that I want to see all the records in that table those are going to be deleted.
If you know how to delete that records you can give me delete command also.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风筝在阴天搁浅。 2024-11-02 09:40:33

以下代码演示了如何使用SQL命令删除记录。

CREATE CURSOR Table1 (pk I)
INSERT INTO Table1 (pk) VALUES(1)
INSERT INTO Table1 (pk) VALUES(2)
INSERT INTO Table1 (pk) VALUES(3)
INSERT INTO Table1 (pk) VALUES(4)
INSERT INTO Table1 (pk) VALUES(5)

SELECT Table1.* FROM Table1 WHERE Table1.pk NOT IN (2, 4)

DELETE FROM Table1 WHERE Table1.pk NOT IN (2, 4)

The following code demonstrates how to use a SQL command to delete records.

CREATE CURSOR Table1 (pk I)
INSERT INTO Table1 (pk) VALUES(1)
INSERT INTO Table1 (pk) VALUES(2)
INSERT INTO Table1 (pk) VALUES(3)
INSERT INTO Table1 (pk) VALUES(4)
INSERT INTO Table1 (pk) VALUES(5)

SELECT Table1.* FROM Table1 WHERE Table1.pk NOT IN (2, 4)

DELETE FROM Table1 WHERE Table1.pk NOT IN (2, 4)
迷离° 2024-11-02 09:40:33

用于为您获取结果的 FoxPro 命令:

BROWSE LAST FOR NOT INLIST(FIELDNAME, 10005347797, 1006009285) && view/edit the records
DELETE FOR NOT INLIST(FIELDNAME,10005347797, 1006009285) && mark the records for deletion
PACK && permanently delete the marked records

注意:根据我使用 FoxPro 的经验,这些命令应该适用于任何版本的 FoxPro。然而它没有经过测试。

FoxPro commands to get the result for you:

BROWSE LAST FOR NOT INLIST(FIELDNAME, 10005347797, 1006009285) && view/edit the records
DELETE FOR NOT INLIST(FIELDNAME,10005347797, 1006009285) && mark the records for deletion
PACK && permanently delete the marked records

Note: Based on my experience with FoxPro, these commands should work with any version of FoxPro. However it is not tested.

独孤求败 2024-11-02 09:40:33

一个问题:

10005347797和1006009285的类型是'string'?

如果是这样,请尝试这个('alltrim'以防万一):

删除表名不
inlist(alltrim(Fieldname),'10005347797','1006009285')

else

只使用不带单引号的

endif

  • 顺便说一句,英语不是我的第一语言

A question:

type of 10005347797 and 1006009285 are 'string'?

if so, try this ('alltrim' just in case):

delete tablename for not
inlist(alltrim(Fieldname),'10005347797','1006009285')

else

just use without the single quotes

endif

  • btw, English is not my 1st language
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文