Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2006, 11:50 AM
Authorized User
 
Join Date: Jun 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Select the latest date, then the lowest price.

Hi folks

I am struggling with an update query.
What I need to do is group a [part code], select the latest available date then from that selection select the [lowest price] for each [part code]

[part code]
[date]
[lowest price]

Any one got any great ideas on where to start?

Stuart
 
Old October 11th, 2006, 12:40 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I have no idea what you are asking.

You need to select a result set from a table and then from that resultset you need to select the latest available date and then from that result set you need the lowest price?

Is that correct?

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old October 12th, 2006, 03:42 AM
Authorized User
 
Join Date: Jun 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That is indeed correct.

So If I had this data....

sku1 21.00 09/10/2006
sku1 20.00 08/10/2006
sku1 19.00 08/10/2006
sku1 20.00 09/10/2006
sku2 31.00 09/10/2006
sku2 30.00 08/10/2006
sku2 29.00 08/10/2006
sku2 30.00 09/10/2006

--------------------------
I want this to update another table.

sku1 20.00 09/10/2006
sku2 30.00 09/10/2006

--------------------------

Sorry I did not explain well.

Stu





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select min(price) Group By sku = duplicates Stuart Stalker SQL Server DTS 2 March 6th, 2006 01:36 AM
lowest Price Fetching dpkbahuguna Beginning VB 6 2 February 28th, 2006 07:15 AM
date and price queries beanfair Access 1 April 20th, 2005 03:34 AM
get a lowest price Jane SQL Language 1 March 11th, 2005 10:02 AM
Query to Select latest X entries acdsky Classic ASP Databases 3 July 6th, 2004 01:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.