Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Improve a table with repeated names
Message
From
03/07/2003 10:26:39
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00806453
Message ID:
00806544
Views:
17
But you still need an id or something to be able to relate the 2 tables. Having a table with one field (names) and another table with 3 fields (field1, field2, field3) won't give you anything useful. Now, names is not a very good primary index to relate on. You'll need an id field in the name table and a nameid field in the products table. That SQL won't do it for you.

You'll need to do a select distinct to get the names, but with an added field - maybe something like:
Select distinct space(7) as id, names from nametable into table names
Then fill in the id field with an id for each name (something sequential).

Then:
Select b.id as nameid, a.field1, a.field2, a.field3 from nametable a, names b ;
 into table products ;
 where a.names = b.names
Then you can relate from names to products on the id field.

Alan

>Alan
> About your doubt
> The older table was created in a wrong way
> I think the correct is a table with on name of client
> and other with the products
> Then guy created a only table, so the client
> name has to be repeated
>
> Moses
Previous
Reply
Map
View

Click here to load this message in the networking platform