Note that there are some explanatory texts on larger screens.

plurals
  1. POSelecting duplicates from multiple joined tables
    primarykey
    data
    text
    <p>I have a customer_product table where the identifier is the "stock_code".</p> <p>I then have three tables: </p> <ul> <li>bom_component</li> <li>routing</li> <li>material_process</li> </ul> <p>Each of these tables are joined to a customer_product via it's stock_code and contain various other fields. </p> <p>I'm trying to select customer_products where the records in the other three tables are exactly the same and only return the stock_code of the duplicates.</p> <p>Any help figuring this out would be great, thanks.</p> <p>EDIT: To clarify, when I said "where the records in the other tables are the same" I meant:</p> <p>(taking routing for example)</p> <p>stock_code&nbsp;&nbsp;department&nbsp;&nbsp;sequence<br/> 1234&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goodsin &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br/> 1234&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prep &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2<br/> 1234&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;packing &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3<br/> 3344&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goodsin &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br/> 3344&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prep &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2<br/> 3344&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;packing &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3<br/> 5661&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goodsin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br /> 5661&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;packing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</p> <p>Here the stockcodes 1234 and 3344 would be returned because their records in routing are exact matches.</p> <p>And I'm using mySQL.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload