473,398 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Delete date values if not MAX date

I have a set of data that has two dates for each row.
The second set of dates is repetitive in some cases.
I only want the last(MAX) date retained for this second set of dates.
The raw data shows:
ID Date1 Date2
312 1/12/2013 1/18/2013
312 1/12/2013 1/29/2013
312 1/21/2013 1/29/2013
312 1/25/2013 1/29/2013
312 1/21/2013 2/20/2013
312 1/25/2013 2/20/2013

The results should be:
ID Date1 Date2
312 1/12/2013 1/18/2013
312 1/12/2013
312 1/21/2013
312 1/25/2013 1/29/2013
312 1/21/2013
312 1/25/2013 2/20/2013

Any thoughts?
Apr 17 '14 #1

✓ answered by kimomakano

Thanks Rabbit,
But it is not working for me, I forgot to clarify that this is only a subset of the data. There are multiple values for ID as well.
When I return the max of date1, grouped by date2 I lose some of the values for date1, I don't want that.

4 1349
Rabbit
12,516 Expert Mod 8TB
Create a query that returns the max of date 1 grouping by date 2. You can then outer join that back to the table to find the ones that aren't the max.
Apr 17 '14 #2
Thanks Rabbit,
But it is not working for me, I forgot to clarify that this is only a subset of the data. There are multiple values for ID as well.
When I return the max of date1, grouped by date2 I lose some of the values for date1, I don't want that.
Apr 17 '14 #3
Rabbit
12,516 Expert Mod 8TB
Then group by ID as well. You're supposed to lose some of the values for Date 1, that's the whole point, to only leave the values you want to keep. The last part of my post, where you join it back to the table is where you get the rest of the data.
Apr 17 '14 #4
ck9663
2,878 Expert 2GB
If it's the last date, why did 1/18 was returned being the earlier date. Why 1/21 returned blank? Why are there two dates for 1/25? The requested output does not make sense to me.


~~ CK
Apr 26 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Tim Davidge | last post by:
Hi folks, been a while since I have posted a plea for help and I think I have forgotten everything I learnt from the helpful contributors to this newsgroup, that said however : I'm trying to...
1
by: Uli | last post by:
Hi, A collegue of mine has made an access entry field and keyed in all the data. Now I have to key in the same data in the same database. However, I first need to delete the values in several...
2
by: Keith | last post by:
Good Afternoon, New to .Net. I am trying to pass date/time values to a MS Access query depending on what value is selected from a dropdown list box (January, February, etc). I have declared...
6
by: Dean Slindee | last post by:
I am looking for the "right" way to handle inserting and presenting null date values. Public Const c_NullDate As Date = #12:00:00 AM# If I set the value of a date variable in an SQL Server insert...
1
by: Olaf Rabbachin | last post by:
Hi folks, I have a table in an Access-DB that has a date-field (date + time). I'd like to use a DataSet + DataGrid to achieve a grouped/hierarchical display where the user would work his/her way...
5
by: Kermit Piper | last post by:
Hello, I am comparing two date values, one from a database and one that has been converted from a hard-coded string into an actual Date type. So far so good. The problem I'm having is that one...
7
by: Shani Aulakh | last post by:
Hi there, I have a FolderWatcher.cs class that will monitor a given folder and delete files older than X number of days. I have the following methods. I need to add/show delete mothod using date...
4
by: azura | last post by:
hello sir... i had a problem... how can i delete two values?? before this i delete in one value only and it's work.. but how can i delete if i had two value...?? this is my coding for one value... ...
1
by: SEhtesham | last post by:
Hi, My application is in VS2008 coded in vb.net.I have a table with three columns FromDate,Todate and Schedule.FromDate and ToDate will have date values whereas Schedule will have a any of...
3
by: Benna | last post by:
I’m using VB.06 program. I am trying to do a check details between 2 date values records stored inside database are only start date and end date. For example, I’m searching between 2 datetime...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.