Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 DISTINCT PRICEs for same PARTS

Author  Topic 

winstonsmith6076
Starting Member

4 Posts

Posted - 2014-07-01 : 14:29:54
Team

I am looking to generate a query that presents all of the unique prices paid for that same part number.

Each row has the part number (PARTNUM), quantity (QTY), invoice date (INVDATE), and the price paid (PRICE). As the prices change over the year, the price paid might or might not be different for that same part number.

I would like to generate a query with PARTNUM, PRICE that shows only the unique prices for that part number.

How would I code that?

Thanks in advance.

Winston

Winston Smith 6076

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-07-01 : 14:31:51
[code]SELECT DISTINCT PARTNUM, PRICE FROM YourTable;[/code]
Go to Top of Page

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2014-07-01 : 14:46:48
Wow James - You replied in 1 min and 57 sec

Thats so cool.
Go to Top of Page

winstonsmith6076
Starting Member

4 Posts

Posted - 2014-07-01 : 16:30:32
Will that give me every price for the PARTNUM or only the unique prices for that PARTNUM?

Winston Smith 6076
Go to Top of Page

winstonsmith6076
Starting Member

4 Posts

Posted - 2014-07-01 : 17:05:51
It worked! Thanks.

Winston Smith 6076
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-07-02 : 11:34:50
quote:
Originally posted by bitsmed

Wow James - You replied in 1 min and 57 sec

Thats so cool.

I was waiting in the shadows and pounced on it ;)
Go to Top of Page
   

- Advertisement -