简体   繁体   English

如何根据另一个表中的选择从一个表中检索特定数据?

[英]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.

相关问题 如何将数据从一个表复制到另一表? - How do i copy data from one table to another table? 如何根据另外两个表的计算从一个表中检索数据? - How to retrieve data from one table based on the calculation of another two table? 如何根据另一个表中的值将一个不同表中的特定值添加到行中的列? - How do I add specific values from one different table to columns in a row based off of values in another table? 从一个不在另一个表中的表中检索数据 - Retrieve data from one table that is not in another one 如何循环遍历一个表并根据另一个表中的数据更新特定列? - How do i loop through a table and updating a specific column based on data in another table? 如何将数据从一个表迁移到另一个表中,表 1 中的行是表 2 中的列? - How do I migrate data from one table into another, the rows in table1 being columns in table2? 如何从一个表中选择行作为CSV并根据键插入另一个表? - How do I select rows from one table as CSV and insert into another table based on a key? 如何将数据从一个表复制到另一个服务器上的另一个表? - How do I copy data from one table to another table on another server? 如何根据另一个表从一个表中获取数据? - How can I get data from one table based on another table? 如何在MySQL中使用SELECT语句从一个表中获取数据,并从另一表中覆盖数据? - How do I take data from one table, and overwrite it from another table, with a SELECT statement in MySQL?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM