Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > Need help with your homework?
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Need help with your homework? Need help with a homework question on any programming language? Post questions and help here, not in the language topic forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Need help with your homework? section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 12th, 2007, 11:29 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL script for selecting min and max values

There is a table that has an effective date column and a sequence number column and an employee number. Each employee number may have multiple rows. Each employee's row has an effective date. Each employee's row has a sequence number. Each employee's row has a unique effective date and sequence number combination. The sequence number is automatically assigned when a row is inserted into the table starting with 999 for each employee and decreasing by one for each subsequent row that is inserted for the employee with the same effective date. I need to select one row for each employee that has the maximum effective date but the mininum sequence number by I haven't been able to successfully code it in SQL. Example of rows in the table:
employee number effective date sequence number
     00933 2007-03-01 999
     00933 2007-03-01 998
     00993 2007-02-15 999
     01689 2006-12-10 999
     71553 2007-01-03 999
     71553 2006-12-02 999
     71553 2006-12-02 998

After running this query, I'd expect to see
00933 2007-03-01 998
01689 2006-12-10 999
71553 2007-01-03 999

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How does one get the Max or Min Filename? crabjoe ASP.NET 1.0 and 1.1 Basics 4 January 15th, 2008 04:48 PM
MAX/MIN Value Help slbibs SQL Server 2005 4 November 6th, 2007 04:00 AM
How to set of Min/Max values of Line chart . Sanjay.Verma BOOK: Professional Crystal Reports for VS.NET 0 November 20th, 2006 11:35 PM
SQL Max() and Min() functions help shana Oracle ASP 1 April 25th, 2005 08:34 PM
SQL Max() and Min() Functions Help need... shana Access 1 September 7th, 2004 09:22 AM



All times are GMT -4. The time now is 09:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.