如何在Visual FoxPro中的“In”中运行超过24个值条款?

发布于 2024-10-27 02:23:43 字数 214 浏览 3 评论 0原文

我正在使用foxpro 5.0

我有超过3000条记录来运行查询。例如我的查询是

delete from mytable.dbf where fieldname not in (1,2,3,......3909)

它不会执行。因为foxpro只允许In子句中的24条记录。我怎样才能执行这个查询?
任何简化的想法。

I am using foxpro 5.0

I am having more than 3000 records to run a query.For example my query is

delete from mytable.dbf where fieldname not in (1,2,3,......3909)

It wont execute.Because foxpro allow only 24 records in the In clause.How can I execute this query?
Any simplification ideas.

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

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

发布评论

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

评论(2

妳是的陽光 2024-11-03 02:23:43

以下代码演示了如何根据一个表中的记录删除另一表中的记录。

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)

CREATE CURSOR Table2 (pk I)
INSERT INTO Table2 (pk) VALUES(2)
INSERT INTO Table2 (pk) VALUES(4)


DELETE FROM Table1 WHERE Table1.pk IN (SELECT Table2.pk FROM Table2)

The following code demonstrates how you can delete records in one table based on the records in another table.

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)

CREATE CURSOR Table2 (pk I)
INSERT INTO Table2 (pk) VALUES(2)
INSERT INTO Table2 (pk) VALUES(4)


DELETE FROM Table1 WHERE Table1.pk IN (SELECT Table2.pk FROM Table2)
谎言月老 2024-11-03 02:23:43

您可以尝试研究 SYS(3055) 函数,它允许您调整 FOR 和 WHERE 子句中允许的复杂性。

不过,我会获取您想要保留在临时游标中的字段名值列表,例如“_keep”,然后执行以下操作:

Delete From mytable where fieldname not in (select fieldname from _keep)
Use In Select("_keep")

You could try investigating the SYS(3055) function which allows you to adjust the complexity allowed in FOR and WHERE clauses.

However I would get the list of fieldname values that you want to keep into a temporary cursor, say called '_keep' and then do:

Delete From mytable where fieldname not in (select fieldname from _keep)
Use In Select("_keep")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文