Hi all,
i have 5 item(A,B,C,D,E).Item A is a father of item (B,C).
In my application,when i select item A,it automatic insert item (B,C) to datagrid too.
It means that i selected only item A but it display item (A,B,C) in datagrid.
when i add two more item (D,E).So in datagrid will display 5 item (A,B,C,D,E)
When i use selete statement in sql, it is also display 5 item (A,B,C,D,E).
but i purpose is i want to display only item (A,D,E),For item (B,C) it can't display because they are the child of item A.
Note:
i have 2 table
1.is sale table
2.is for store father item and child item
Here is the table stucture
ColumnName | DataType | Size |
---|
Code | int | |
itemcode | varchar | 20 |
itemname | varchar | 50 |
price | numeric | (18,2) |
qty | int | |
amount | numeric | (18,2) |
ColumnName | DataType | Size |
---|
FatherCode | varchar | 20 |
ChildCode | varchar | 20 |
docdate | datetime | 50 |
How can i use select statement in sql to display only father item and not child item?
Thanks
TONY
[EDIT]
Hi all,
These are my table structure and what i want to display.
TABLE1
Item Code | Quantity |
---|
A | 5 |
B | 1 |
C | 3 |
D | 4 |
E | 5 |
F | 6 |
G | 1 |
H | 3 |
I | 8 |
J | 5 |
TABLE2
Father Code | Child Code |
---|
A | B |
A | C |
D | E |
D | F |
D | G |
H | I |
What i want to display.
Item Code | Quantity |
---|
A | 5 |
D | 4 |
H | 3 |
J | 5 |
Why item(B,C,E,F,G,I) are not display?Because they are the child item of item (A,D,H) and item(J) is not child or father of other item.
Thanks
TONY
[/EDIT]