all groups > sql server connect > august 2006 >
You're in the

sql server connect

group:

Complex Query (atleast I think so)


Re: Complex Query (atleast I think so) JJBrooks NO[at]SPAM aol.com
8/10/2006 1:03:55 PM
sql server connect:
Oracle has a CONNECT BY clause that makes this easy. Unfortunitly for
SQL Server you have to go thru this mess:

http://vyaskn.tripod.com/hierarchies_in_sql_server_databases.htm
Re: Complex Query (atleast I think so) Arnie Rowland
8/10/2006 1:10:19 PM
SQL 2000 or SQL 2005?

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


[quoted text, click to view]

Re: Complex Query (atleast I think so) Arnie Rowland
8/10/2006 2:05:00 PM
Perhaps these articles on recursive queries will get you moving in a
direction that works to solve your problem.

http://www.paragoncorporation.com/ArticleDetail.aspx?ArticleID=9
http://www.yafla.com/papers/sqlhierarchies/sqlhierarchies.htm
http://www.wwwcoder.com/main/parentid/191/site/1857/68/default.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro03/html/sp03i8.asp

http://www.sqlservercentral.com/columnists/fBROUARD/recursivequeriesinsql1999andsqlserver2005.asp
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc


Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


[quoted text, click to view]

Complex Query (atleast I think so) <Preacher Man>
8/10/2006 2:43:06 PM
We have a couple of Bill of Material tables in our SQL 2000 database and I
need to extract information.

The first table is the master table and the only relevant field is fpartno.
Table two is the child table, and it contains all of the parts that make up
the fpartno in the master table. The only two relevant fields are
fcomponent and fcparent.

In the child table a component (Part No) may be in the table several times
because we may use it in different parent parts. And to complicate things,
the child table usually includes multiple levels of material.

How can I query the table so that it will pass over the table as many times
as needed to get the full multiple level bill of material.

Here would be a simple example.
PartA
PartB
PartC
PartD
PartE
PartF

As you can see the BOM for PartA goes out multiple levels. Any ideas on how
I can query this?

Thanks.


Re: Complex Query (atleast I think so) <Preacher Man>
8/10/2006 3:46:37 PM
SQL 2000.

[quoted text, click to view]

AddThis Social Bookmark Button