Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table Update
Message
De
25/05/2008 08:35:51
 
 
À
25/05/2008 07:57:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01319401
Message ID:
01319412
Vues:
16
>Yes OLAF
>
>You wrote as I want.
>
>Thanks for understanding my question

Well I'd rather split the table into two:


create cursor table1 ;
(id I, maincode char(4), qty n(4))

insert into table1 values (1,'1401',1)
insert into table1 values (2,'1402',0)

create cursor table2 ;
(id I, code char(3), maincodeid I)

insert into table1 values (1,'',1)
insert into table1 values (2,'007',1)
insert into table1 values (3,'010',1)
insert into table1 values (4,'025',1)
insert into table1 values (5,'',2)
insert into table1 values (6,'088',2)
insert into table1 values (7,'101',2)
insert into table1 values (8,'225',2)

Now the qty is only in one place. No redundancy.

If you nee the list of code, qty, you'd

Select (table1.maincode+table2.code) as code, table2.qty from table1;
left join table2 on table2.maincodeid = table1.id

So you'd need complexer sql to read the data as you want to display it,
but you store the qty only once.

Bye, Olaf.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform