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:
01398730
Views:
54
>>>Hi,
>>>
>>>I know the title is not very clear and what I am looking for should not be hard. But I just can't get it (blame it on Friday or spring).
>>>
>>>Anyway. A SQL Select creates a query with one table JOINed with another. My question is, how can I determine which record in the query came from the 1st or the 2nd table in the JOIN? I realize that at least one record in the query came from both tables. So if I can determine this (joint) record, it would be helpful too.
>>>
>>>Thank you in advance.
>>
>>Dmitry,
>>
>>Can you please post your SQL or at least prototype, so we would be able to see, what do you mean?
>>
>>I'm thinking it's impossible to find out this info, but I need to see some SQL to better understand, if this is possible or not.
>
>Here is an example:
>
>For every record in table MyTable1 there could be 1 or more records in MyTable2. And the SQL Select is:
>
>
>select * from MyTable1 join MyTable2 on MyTable1.Pk = MyTable2.Pk
>
>
>Helpful? <g>

Each record in the table 1 would be matched with each record from the table2 based on the PK. What information can you get besides that?

Also name each field specifically, then probably it would be a bit more clear.

select Table1.Field1 as FT1, Table2.Field1 as FT2, etc.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform