| | |
Connect by prior command
Please support our MS SQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
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: 557
Reputation:
Solved Threads: 64
0
#2 Nov 10th, 2009
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
Views: 685 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last age autogrowth business connectingtodatabaseinuse count cursor data database dateadd datediff datepart day" dbsize deadlock delete_trigger exploit getdate hack highperformancecomputing hpc hpcserver2008 ibm iis limit live loop maximum microsoft ms mssql multiple multithreading news number password permission position query reporting result security server services sets single source sql sql-injection sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday





