| | |
Connect by prior command
Please support our MS SQL advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2009
Posts: 1
Reputation:
Solved Threads: 0
Hi All,
Can anybody give me a solution how to solve or write a query for this scenario?
there is table called ITT1 with the columns
FATHER, CHILD_NUM, CODE, CODE_QTY
a 1 b 1
b 1 c 1.5
c 1 d 2
d 1 e 1
There are 3 columns father,child_num,code & the code_quantity.
It is explained as 'a' is my FINAL finished good and is produced from raw material 'b' using 1kg.
and here 'b' becomes my finished good and is produced from raw material 'c' using 1kg.
and here 'c' becomes my finished good and is produced from raw material 'd' using 1kg.
and here 'd' becomes my finished good and is produced from raw material 'e' using 1kg.
now i want how much raw material 'e' is required to produced for eg. 20kg of 'a'
should i use connect by prior or sub queries will help in this regards.
kindly advice.
Regards,
Faheem
Can anybody give me a solution how to solve or write a query for this scenario?
there is table called ITT1 with the columns
FATHER, CHILD_NUM, CODE, CODE_QTY
a 1 b 1
b 1 c 1.5
c 1 d 2
d 1 e 1
There are 3 columns father,child_num,code & the code_quantity.
It is explained as 'a' is my FINAL finished good and is produced from raw material 'b' using 1kg.
and here 'b' becomes my finished good and is produced from raw material 'c' using 1kg.
and here 'c' becomes my finished good and is produced from raw material 'd' using 1kg.
and here 'd' becomes my finished good and is produced from raw material 'e' using 1kg.
now i want how much raw material 'e' is required to produced for eg. 20kg of 'a'
should i use connect by prior or sub queries will help in this regards.
kindly advice.
Regards,
Faheem
•
•
Join Date: Sep 2009
Posts: 521
Reputation:
Solved Threads: 60
0
#2 13 Days Ago
MS SQL Syntax (Toggle Plain Text)
SELECT code_qty *10 FROM ITT1 WHERE code= (SELECT father FROM ITT1 WHERE code= (SELECT father FROM ITT1 WHERE code = (SELECT father FROM ITT1 WHERE code = 'a') ) )
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
![]() |
Similar Threads
- sql query problem with MS Access and C# (C#)
- $HTTP_POST_VARS['command'] (PHP)
- OS 10.4 2 Win2k server problem (OS X)
- how to make a simple script? (C++)
- I am New In MySQL. Problem With MySQL Database Plz Help. (MySQL)
- how to setup squid server (*nix Software)
- Help With Networkanywere router? (Networking Hardware Configuration)
Other Threads in the MS SQL Forum
- Previous Thread: Stored Procedures to insert into a table
- Next Thread: MS SQL Recursion problem
| Thread Tools | Search this Thread |





