composite keys

Microsoft Visual FoxPro - Programmer Exchange

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
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

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

I hope this helps. 

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

Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
Purchase VFP8 here:
Keep an eye on the product lifecycle for Visual FoxPro here:;[ln];lifeprodv
   - VFP5 Mainstream Support retired June 30th, 2003
   - VFP6 Mainstream Support retires Sept. 30th, 2003