|
Home > Archive > Programming with dBASE > December 2006 > Sorting Child Records
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Sorting Child Records
|
|
| Pat Curran 2006-12-08, 5:17 am |
| Hi;
I use set relation for a parent table with child records like this:
SELECT persdata
SET relation TO ssan into perstran constrain ADDITIVE
This will show me only the records that match the SSN for an individual. My
question is, how do you sort the child records? As soon as I try to put the
child records displayed in a different order, all records show regardless of
the SSN. How can I change the sort order of the child table with out
affecting the set relation...constrain?
Thanks
Pat
| |
| Lysander 2006-12-08, 5:17 am |
| Pat Curran schrieb:
> Hi;
>
> I use set relation for a parent table with child records like this:
> SELECT persdata
> SET relation TO ssan into perstran constrain ADDITIVE
>
> This will show me only the records that match the SSN for an individual. My
> question is, how do you sort the child records? As soon as I try to put the
> child records displayed in a different order, all records show regardless of
> the SSN. How can I change the sort order of the child table with out
> affecting the set relation...constrain?
You don't need to set a relation for that.
Relations are buggy in dBase, anyway.
select
s.<fields>
from
persdata p
join
ssan s
on p.<idfield> = s.<idfield>
replace <fields> with the fields from ssan you would like to have in
the result, and <idfield> with the field needed to join the 2
tables. For example: student-id.
ciao,
André
| |
|
| > I use set relation for a parent table with child records like this:
> SELECT persdata
> SET relation TO ssan into perstran constrain ADDITIVE
>
> This will show me only the records that match the SSN for an individual.
> My question is, how do you sort the child records? As soon as I try to put
> the child records displayed in a different order, all records show
> regardless of the SSN. How can I change the sort order of the child table
> with out affecting the set relation...constrain?
Create an index on the perstran table to include the ssan field plus the
field(s) that you want to sort by.
For example: ssan+lastname+firstn
ame
| |
| Roland Wingerter 2006-12-08, 7:13 pm |
| Pat Curran wrote
>
> I use set relation for a parent table with child records like this:
> SELECT persdata
> SET relation TO ssan into perstran constrain ADDITIVE
------
This is the old xBASE style. If you want to move on to the OODML way of
doing things,
check out the articles in the Knowledgebase, e.g.
http://www.dbase.com/Knowledgebase/...odml.htm#SETREL
Mind you, there is a lot to learn, but it's well worth it.
Roland
| |
| Gerald Lightsey 2006-12-09, 12:13 am |
| On Fri, 8 Dec 2006 18:53:32 +0100, in the dbase.programming group,
Roland Wingerter said...
> Pat Curran wrote
> ------
> This is the old xBASE style. If you want to move on to the OODML way of
> doing things,
> check out the articles in the Knowledgebase, e.g.
>
> http://www.dbase.com/Knowledgebase/...odml.htm#SETREL
>
> Mind you, there is a lot to learn, but it's well worth it.
I believe Pat uses VdB 5.7 so cursors in work areas are the only choice.
Gerald
|
|
|
|
|