Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Duplicate Count

$
0
0

Hi All,

I'm having an issue with creating a sales price list after a recent change in ERP systems.

The previous system stored data in a horizontal format, so like this;

Product Code Qty Price Qty_2 Price Qty_3 Price

12345 1 100 5 95 200 80

But, the new software stores data in a vertical format, so like this;

Product Code Qty Price

12345 1 100

Product Code Qty Price

12345 5 95

Product Code Qty Price

12345 200 80

What i'm attempting to do is to get SQL to count the number of records that are duplicate - Not group the number, so in the example above 1,2,3. Then when the next product code is entered recount again so, if there are ten price breaks on the next item 1,2,3,4,5,6,7,8,9,10.

From research i think i'm looking for HAVING, or COUNT.

Regards

David


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>