Is there an elegant way to do a select on a parent table which then only retrieves its child rows based on what was selected in the parent table?
Basically, I'd like to use the built in feature of startrecord and maxRecords. I'd like to say, give me the first 4k records of this parent table and also retrieve all child tables that belong to the selected 4k records. In this way, you won't fail a contraint check, where as you would possibly if you said just give me the first 4k records in both parent and child tables. Obviously, in a larege database you can't simply say Select all.
Is there a built in way to do this?
Relational / Hierarchical Select
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
Unfortunately, we do not provide such built-in functionality.
Probably, if the selecting criteria for the parent table is known beforehand you might use this code:
Additionally, if you are making a master-detail datagrids you might be interested in the following sample:
%Program Files%CoreLab\MyDirect.NET2\Samples\WinForms\
Probably, if the selecting criteria for the parent table is known beforehand you might use this code:
Code: Select all
SELECT * FROM childTable WHERE (FK_id_PT = SELECT id_PT FROM parantTable WHERE (columnName=:paramName));
%Program Files%CoreLab\MyDirect.NET2\Samples\WinForms\