Foxpro为每位客户选择最新订单

时间:2017-08-11 17:53:32

标签: visual-foxpro

在foxpro表中,我有4个字段:ordernum,orderdate,ordertotal,custpk。

foxpro select语句从每个custpk的最新订单返回所有这些字段是什么?

1 个答案:

答案 0 :(得分:0)

  

我需要一个foxpro命令,而不是SQL数据库

让我们首先说一下Foxpro命令行你不会得到你想要的东西。

相反,在Foxpro中获取此功能的最方便的方法是使用在FP / VFP数据表上运行的Foxpro的SQL查询命令,并将结果数据导入数据表/游标。

SELECT CustPk, OrderNum, OrderDate, OrderTotal FROM MyDataTable ORDER BY CustPk, OrderDate Desc INTO CURSOR OrderedData READWRITE
* --- Now ordered data is in memory cursor, use it however you need ---
* --- Each Customer's Most Recent Order will be first record ---
SELECT OrderedData
* --- You might just want to BROWSE the results to understand how the data appears ---
* --- Or you can do anything else with the data ---
< do whatever >  

有很多方法可以获得每位客户的最新订单,但从这里开始,看看是否能满足您的需求。

BTW:您可能希望花一些时间查看免费的在线VFP教程视频: Free Visual Foxpro Videos

祝你好运