473,402 Members | 2,053 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,402 software developers and data experts.

Selecting Specific Dates

Hello,

I'm still trying to write sql on Access but I always seem to mess up
with the syntax. I want to write a query from a table called tb_Test:

LoanNbr Date Rating
123456 02/15/05 6
987654 05/06/04 5
987654 04/09/02 4
565864 01/07/03 7

This is what the result should look like:

LoanNbr Date Rating
123456 02/15/05 6
987654 05/06/04 5
565864 01/07/03 7

Notice that there are two records for the same LoanNbr, but I want to
choose the record with the latest date.

Any help would be very appreciated.

Thanks.

Edwin

Nov 13 '05 #1
1 1661
Select * from tb_test inner join
(Select LoanNbr, max([date]) as Mdate from tb_test group by LoanNbr) as q1
on tb_test.loannbr = q1.loannbr and tb_test.[date] = q1.mdate

Peter
<ed**************@citigroup.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Hello,

I'm still trying to write sql on Access but I always seem to mess up
with the syntax. I want to write a query from a table called tb_Test:

LoanNbr Date Rating
123456 02/15/05 6
987654 05/06/04 5
987654 04/09/02 4
565864 01/07/03 7

This is what the result should look like:

LoanNbr Date Rating
123456 02/15/05 6
987654 05/06/04 5
565864 01/07/03 7

Notice that there are two records for the same LoanNbr, but I want to
choose the record with the latest date.

Any help would be very appreciated.

Thanks.

Edwin

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Phil Powell | last post by:
I am producing a form using PHP on the back end and Javascript on the front end. The resulting script will come to the browser as follows: <script> <!-- function selectAll() { moveElement =...
1
by: Mark | last post by:
Hi - I have a numebr of rooms, which I am making available. table: single - has single_id and single_name rental_single has rental_id, single_id, check_in and check_out They are linked by...
3
by: Simon G Best | last post by:
Hello! The C++ standard library provides facilities for finding out the sizes (and other such stuff) of numeric types (::std::numeric_limits<>, for example). What I would like to do is to...
1
by: John Rappold | last post by:
I've Googled this, but can't find an answer to my problem. When a user selects a page with the recordset I want it to list dates that fall into a certain range, related to CURDATE(). The range...
1
by: Ange Kappas | last post by:
I am trying to make a workable database with Access for a reservations program for a small hotel that I own BUT I am stuck at either a SQL command or Visual Basic code which will tell me which...
2
by: Catherine | last post by:
I have a database where in my query I need to be able to locate accounts that show a date greater than 14 days from the current date. How would I structure this to allow for all accounts that over...
1
by: vunderusaf | last post by:
I have a listbox on a form that is selecting using named FinalQuery: SELECT ., ., . FROM FinalQuery; Now I have a text field with a date on this form and I'd like to use that date as the...
4
by: Good Man | last post by:
Hi there I have a list of jobs scheduled in a MySQL table, with start dates and end dates, like so: SchedID | JobID | StartDate | EndDate |...
2
by: movieking81 | last post by:
If someone could help me with this, that would be great. I need to select a number of records from an SQL table based on a date range, so I started with this select. <html> <code> resultssql =...
3
by: pjewett | last post by:
Hi All, New to the forum and to SQL. I'm running a query to pull sales records for a specific customer that returns several dates (for each transaction). I only need the most recent date from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.