Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have found your site brilliant. What makes it good are the people that contribute to the site..."

Geography

Where in the world do Tek-Tips members come from?
John1Chr (TechnicalUser)
11 May 12 13:45
CTValue
1 14224
2 14224
3 14224
4 14224
5 14224
6 14225....

CFATTRIB
1 PROG
2 PROG
3 ACT
4 LLC
5 APT


CFATTVAL
1 1010
2 1020
3 101010
4 4
5 22

EFFDT
1 3/1/2004
2 3/2/2004
3 3/5/2004
4 3/1/2004
5 2/1/2005


I want the CFATTVAL value for the max effect date for CFATTRIB PROG for the CTVALUE (ie.1020 for 14224.) This should be simple, right? I can't seem to get all of the CTValues

(Select Max(EFFDT) From [Table1] M WHERE M.CTValue = [Table1]![CTVALUE] ) is where I'm at...not working.

Sorry - had trouble trying to post as a table. all the 1's are the first record in the fields of table1.
John1Chr (TechnicalUser)
14 May 12 8:19
This works not sure if it's best though -

SELECT t.CTValue
, t.CFATTRIB
, t.CFATTVAL
, t.EffDt
FROM ( SELECT CTValue
, CFATTRIB
, MAX(EffDt) AS latest
FROM Table1
GROUP
BY CTValue
, CFATTRIB) AS m
INNER
JOIN Table1 AS t
ON t.CTValue = m.CTValue
AND t.CFATTRIB = m.CFATTRIB
AND t.EffDt = m.latest

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close