I have a table where we have barcodes and order numbers, so, I am trying to find all the barcodes that are being assigned to multiple orders.
Example table
barcode | ord_no |
---|---|
1233 | 1 |
1234 | 2 |
1233 | 3 |
1235 | 4 |
1236 | 5 |
1237 | 6 |
1235 | 7 |
1238 | 8 |
expected output
barcode | ord_no |
---|---|
1233 | 1 |
1233 | 3 |
1235 | 4 |
1235 | 7 |
2
Answers
What you should do is to find barcodes you need (b_mult) and then join them to themselves in order to find order numbers
an example
Use a window function: