| Author |
incorrect MAX result with query. (diagram photo included)
|
Peter Primrose
Ranch Hand
Joined: Sep 10, 2004
Posts: 755
|
|
Hi all, I have the following SQL statement that returns the table-photo below: I would like to get the *latest* note from each entity_id from the table (the resulted query). For this I did: but the results are incorrect. the max(note_date) is correct but not the note?!?!?! any idea what am I doing wrong? thanks
|
 |
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3652
|
|
|
All records in a query result set must be uniform in type. Therefore, your combination "SELECT MAX(note_date),..." will not work since it should return the max note date and all records joined with in. If you want a single record you need to indicate that such as "select record where note_date = (select max(note_date))".
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
Peter Primrose
Ranch Hand
Joined: Sep 10, 2004
Posts: 755
|
|
|
yep....thank you!
|
 |
 |
|
|
subject: incorrect MAX result with query. (diagram photo included)
|
|
|