Hi Moises;
to get to new tables out of the original:
SELECT DISTINCT;
Cur1.Field1 AS cName;
FROM Original_Table AS Cur1;
INTO TABLE tabNames
SELECT;
Cur1.Field2,;
Cur1.Field3,;
Cur1.Field4;
FROM Original_Table AS Cur1;
INTO TABLE tabWithOutNames
as I understand your inital question you would like to use the first result as a kind of preselect the second one.
This will only work if they have something common ( Field1? ). So you need field1 in the second table.
SELECT;
Cur1.Field1,;
Cur1.Field2,;
Cur1.Field3,;
Cur1.Field4;
FROM Original_Table AS Cur1;
INTO TABLE tabWithOutNames
SET INDEX TO Field1 TAG _Field1
SELECT DISTINCT;
Cur1.Field1 AS cName;
FROM Original_Table AS Cur1;
INTO TABLE tabNames
SET RELATION TO cName INTO tabWithOutNames
HTH
Agnes
>Thank you Caroline
>But I think I mistyped my question
>
>I need sql command to create 2 new tables from my table
>
>I have a table with struct (4 fields)
>
> Name(field1)
> Field2
> Field3
> Field4
>
> I have many repated names (field1)
>
> Carl
> John
> Carl
> Moses
> Carl
> Etc.
>
>
> I need I new table for name (without repeat names)
>and I new table for field1, field2 and field3
>
>Moses
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]