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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Compare Prices

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-13 : 08:06:11
Ryan writes "How can I get the lowest price for the same product in 2 tables, Great Buy and Contract List?

GreatBuy
ProdCode Price
1 $5.00

ContList
ProdCode Price
1 $2.00

The query that I required will return price of $2.00. Hope to get a reply from u soon. Thks."

macka
Posting Yak Master

162 Posts

Posted - 2002-06-13 : 08:27:17
select prodcode,min(price) minprice
from (
select prodcode,price
from greatbuy
union
select prodcode,price
from contlist) allprices
group by prodcode

macka.

Go to Top of Page

theerut
Starting Member

1 Post

Posted - 2011-04-20 : 09:27:29
unspammed
Go to Top of Page
   

- Advertisement -