[英]How do I retrieve specific data from one table based on a selection in another table?
From Borland C++ Builder, I have two Paradox tables: one has manufacturer names, the other the manufacturer names along with their products. 在Borland C ++ Builder中,我有两个Paradox表:一个具有制造商名称,另一个具有制造商名称及其产品。 The data is set in two DBGrids. 数据在两个DBGrid中设置。 In the manufacturer grid I want to be able to select a manufacturer and have that manufacturer and its related products show up in the other grid. 在制造商网格中,我希望能够选择一个制造商并将该制造商及其相关产品显示在另一个网格中。 I am new to this. 我是新来的。 I searched the database here and found some things to try, but...I think I'm just doing it wrong. 我在这里搜索数据库,找到了一些可以尝试的方法,但是...我认为我做错了。 I have two tables and two datasources, each set taking a grid. 我有两个表和两个数据源,每个数据源都带有一个网格。 I placed an SQL Query on the form and gave it this: 我在表单上放置了一个SQL查询,并为此提供了它:
select customers.cust
from products inner join products on customers.cust = products.custid
And while the query doesn't fail, it doesn't do anything for me, either. 虽然查询没有失败,但对我也没有任何帮助。 Will someone please help me understand this? 有人可以帮我理解吗? Thank you. 谢谢。
I haven't worked with Paradox but try this: 我没有使用Paradox,但可以尝试以下操作:
select customers.cust
from customers
inner join products on customers.cust = products.custid
currently it looks like you are joining products with itself which doesn't seem to be what you want to do. 目前看来,您正在将产品与自身结合在一起,这似乎并不是您想要做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.