If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Identical BOM's

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-09, 14:35
RedNeckGeek RedNeckGeek is offline
Village Idiot
 
Join Date: Jul 2003
Location: Michigan
Posts: 1,941
Identical BOM's

I have a Bill Of Materials table with this structure

Product
Part
Qty

Of course, some products can have more parts than others.

I'm trying to products that have identical BOM's, that is - same parts, and same qty of each part. I've been messing with it for a few hours, and now I don't think it's possible, but figured I'd ask here before I gave up.

(I'm using SQL Server 2000 if that helps)
__________________
Inspiration Through Fermentation
Reply With Quote
  #2 (permalink)  
Old 07-07-09, 17:19
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,578
You can build a single table containing the BOM for all products and add 1 column for the product name if it is not yet in that table. Now you can join this table with itself. The first join checks that for all rows of product1 you will have a matching row for product2. You do the same with product2 -> product1. Whatever remains are the matching products. You may have to count the number of rows for each product before and after the filtering and then compare those numbers to make sure nothing was filtered-out during the row-wise comparison.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On