追加多个表的内容 - Visual FoxPro

发布于 2024-10-07 06:46:16 字数 768 浏览 2 评论 0原文

我正在使用带有 Visual Foxpro 后端的会计系统。每个月,所有发票和付款都会从当前发票/付款表移动到仅包含该月数据的新表(在不同的目录中)。例如:

MainDBDir
    currentInvoices.dbf   (contains Dec invoices)
    currentPayments.dbf  (contains Dec payments)
    2010Dir
        NovDir
            invoices.dbf (contains Nov2010 invoices)
            payments.dbf (contains Nov2010 payments)
        OctDir
            invoices.dbf (contains Oct2010 invoices)
            payments.dbf (contains Oct2010 payments)

我需要对最近六个月的数据执行查询。有没有办法可以在单个 Visual Foxpro 查询中连接多个表(来自多个目录)?

我需要这样的东西:

 select * from concatenate(currentInvoices, 2010Dir/NovDir/invoices.dbf, 2010Dir/OctDir/invoices) where invoice_number like '12345'

我不想为每个表执行单独的查询...

谢谢

-乔纳森

I'm working with an accounting system with a Visual Foxpro backend. Every month, all of the invoices and payments are moved from the current invoices/payments table to a new table (in a different directory) with just that month's data. For example:

MainDBDir
    currentInvoices.dbf   (contains Dec invoices)
    currentPayments.dbf  (contains Dec payments)
    2010Dir
        NovDir
            invoices.dbf (contains Nov2010 invoices)
            payments.dbf (contains Nov2010 payments)
        OctDir
            invoices.dbf (contains Oct2010 invoices)
            payments.dbf (contains Oct2010 payments)

I need to execute a queries on the last six months of data. Is there a way I can concatenate multiple tables (from multiple directories) in a single Visual Foxpro query?

I need something like this:

 select * from concatenate(currentInvoices, 2010Dir/NovDir/invoices.dbf, 2010Dir/OctDir/invoices) where invoice_number like '12345'

I'd rather not execute a separate query for each table...

Thanks-

Jonathan

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

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

发布评论

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

评论(1

仙女山的月亮 2024-10-14 06:46:16

您可以使用 union 语句连接查询。

示例:

select * from currentInfoices.dbf
  where invoice_number like '12345'
union
select * from "2010Dir\OctDir\invoices.dbf"
  where invoice_number like '12345'
union
select * from "2010Dir\NovDir\invoices.dbf"
    where invoice_number like '12345'

select * 
  from (select * from currentInfoices.dbf
          union select * from "2010Dir\OctDir\invoices.dbf"
     union select * from "2010Dir\NovDir\invoices.dbf") q
  where invoice_number like '12345'

You can concatenate the queries by using a union statement.

Example:

select * from currentInfoices.dbf
  where invoice_number like '12345'
union
select * from "2010Dir\OctDir\invoices.dbf"
  where invoice_number like '12345'
union
select * from "2010Dir\NovDir\invoices.dbf"
    where invoice_number like '12345'

or

select * 
  from (select * from currentInfoices.dbf
          union select * from "2010Dir\OctDir\invoices.dbf"
     union select * from "2010Dir\NovDir\invoices.dbf") q
  where invoice_number like '12345'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文