Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
About CrossTab Query or similar query
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
About CrossTab Query or similar query
Miscellaneous
Thread ID:
00804158
Message ID:
00804158
Views:
66
Hi All,
i have original data like below and its related with textile sector ... i want to sum I/O actions group by orderno,crow,I/O,htyp and show its on the one row group by orderno,crow with SQL how can i do this ?

* crow means colour row number on the original data eg. 1 for L.GRIMEL 2 for D.GRIMEL
* I/O means input-output actions 1 means output 2 means input
* htyp means 1 ok ,2 faulty


type orderno model crow colour IO htyp S M L X L
==== ========== ====== ==== ======== == ==== == === === === ==
1 BDO22HSW01 BD10-1 1 L.GRIMEL 1 1 58 116 116 58 58
1 BDO22HSW01 BD10-1 1 L.GRIMEL 1 1 57 114 114 57 57
1 BDO22HSW01 BD10-1 1 L.GRIMEL 2 2 15 0 0 0 0
1 BDO22HSW01 BD10-1 1 L.GRIMEL 2 1 41 114 114 57 57
1 BDO22HSW01 BD10-1 1 L.GRIMEL 2 2 34 0 0 0 0
1 BDO22HSW01 BD10-1 1 L.GRIMEL 2 1 24 116 116 58 58

1 BDO22HSW01 BD10-1 2 D.GRIMEL 1 1 58 116 116 58 58
1 BDO22HSW01 BD10-1 2 D.GRIMEL 1 1 57 114 114 57 57
1 BDO22HSW01 BD10-1 2 D.GRIMEL 2 2 15 0 0 0 0
1 BDO22HSW01 BD10-1 2 D.GRIMEL 2 1 42 114 114 57 57
1 BDO22HSW01 BD10-1 2 D.GRIMEL 2 2 34 0 0 0 0
1 BDO22HSW01 BD10-1 2 D.GRIMEL 2 1 24 116 116 58 58

finally data should be view like below

type orderno model crow colour IO htyp S M L X L
==== ========== ====== ==== ======== == ==== === === === === ===
1 BDO22HSW01 BD10-1 1 L.GRIMEL 1 1 115 230 230 115 115
1 BDO22HSW01 BD10-1 1 L.GRIMEL 2 1 65 230 230 115 115
1 BDO22HSW01 BD10-1 1 L.GRIMEL 2 2 49 0 0 0 0
1 BDO22HSW01 BD10-1 2 D.GRIMEL 1 1 115 230 230 115 115
1 BDO22HSW01 BD10-1 2 D.GRIMEL 2 1 66 230 230 115 115
1 BDO22HSW01 BD10-1 2 D.GRIMEL 2 2 49 0 0 0 0

also wantto calculate the I/O differences and show only differences > 0 like below

for eg. S size L.GRIMEL output 115 input 65+49=114 115-114 = 1


TIA
Next
Reply
Map
View

Click here to load this message in the networking platform