Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which record in query came from this table?
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01398723
Message ID:
01398764
Views:
46
>>>>>All records are coming from both tables. That's how JOIN works.
>>>>>
>>>>
>>>>Even I knew that <g>. But for every record in Table1 the query pulls 1 or more records from Table2. So I was hoping to be able to find the one record that was the "primary" (I know this is not the right word but you know what I mean) record from Table1.
>>>
>>>Put pk into the result!
>>>
>>>Every pk of the table1 is a table1's record.
>>>Every pk of the table2 is a table2's record.
>>
>>I tried this. But the resulting query has both PKs. So just putting PKs in the resulting query does not seem to help. Unless, as Michael suggested, I order on the PK of Table2 and then the row with the smallest PK value from Table2 is the record from Table 1. Thank you for your suggestion.
>
>Assuming
>
>Table1
>PK  NameField
>1      Name1
>2     Name2
>
>Table2
>
>PK FK NameField
>1    1   Test1
>2    1  Test2
>3    2  Test3
>
>You should get as a result of the join
>
>1  Name1  1 1 Test1 - In the first two records first two columns repeat the information
>1  Name1  2 1 Test2
>2  Name2  3 2 Test3
>
>
What columns in your resulting query the column 3 and column 4; the one that you say will repeat the information?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform