Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table Update
Message
From
25/05/2008 08:35:51
 
 
To
25/05/2008 07:57:30
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01319401
Message ID:
01319412
Views:
15
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform