composite keys

Microsoft Visual FoxPro - Programmer Exchange

Brian
How would you do a composite key in foxpro? I want to do the following

ID1        ID2        NAME
1            1            Jim
1            2            Jimmy
2            1            Tim
2            2            Timmy

basicly id2 is a revision id and id1 is the persons id, so when you look at
id1 you can see all the revisions specified by id2... thanks
                                            
Trey
for composite indexes in vfp you have to concatenate the values in the index
and query accordingly, e.g.

** begin code
index on STR(id1)+STR(id2) tag id1id2
select * ;
 from theTable ;
 where STR(id1)+STR(id2)=STR("1")+STR("2")
** end code



at
                                            
Leemionlinemicrosoftcom
Hi Brian:

Along with Trey's code, take a look at this article and see if it helps:

115426 Indexing on a Character and Numeric Field Together
http://support.microsoft.com/?id=115426

I hope this helps. 

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
   http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
Purchase VFP8 here:
   http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518
 
Keep an eye on the product lifecycle for Visual FoxPro here: 
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
   - VFP5 Mainstream Support retired June 30th, 2003
   - VFP6 Mainstream Support retires Sept. 30th, 2003

index




at