| 1 |
| Author Details | Post Content |
Dr.Flexyjerkov United States Minor Outlying Islands 10/05/2007 @ 16:03 912 Posts (174 Topics)
|
| Access SQL Query help |
Ok, i'm looking for some help with a query i'm trying to make for access.
Table:
Field Name || Data Type || Description ID ----------- AutoNumber -- AUDIT ID ITM_ID ------- Number ------- ITEM ID ACTION -------- Text ---- AUDIT ACTION Comments ---- Memo ------ COMMENTS
What i need to do is: Get the Query to sort the table with ITM_ID ascending then ID desc Then display only ACTION which contain "Damage" then only display the latest ID for each ITM_ID with the ACTION "Damage".
Is this possible?
If you figure it out can you paste me the query or queries.
Thanks |
|
| Back To Top | Reply Reply With Quote |
 |
qui
 United Kingdom 10/05/2007 @ 19:11 1754 Posts (38 Topics)
|
Probably wont be syntactically correct...havn't done access sql
SELECT * FROM Tablename ORDER BY ITM_ID, ID, DESC
SELECT ACTION FROM Tablename WHERE ACTION LIKE 'Damage'
Not sure what you mean by the last bit |
|
| Back To Top | Reply Reply With Quote |
 |
Dr.Flexyjerkov United States Minor Outlying Islands 11/05/2007 @ 09:44 912 Posts (174 Topics)
|
There can be many ID for each ITM_ID
such as: ID ITM_ID Comments 303 M0394 hi 304 M0394 Test 305 M0287 Bob
I want it to only pick out the latest entry for each ITM_ID so for M0394 it will only display the entry for 304.
Does that help? |
|
| Back To Top | Reply Reply With Quote |
 |
Topz
 United Kingdom 11/05/2007 @ 10:01 5993 Posts (28 Topics) i love the cock
|
quote: There can be many ID for each ITM_ID
such as: ID ITM_ID Comments 303 M0394 hi 304 M0394 Test 305 M0287 Bob
I want it to only pick out the latest entry for each ITM_ID so for M0394 it will only display the entry for 304.
Does that help?
The latest being what, 303 or 304? Surely 304 is the latest as it will presumably have been added after? |
|
| Back To Top | Reply Reply With Quote |
 |
Topz
 United Kingdom 11/05/2007 @ 10:03 5993 Posts (28 Topics) i love the cock
|
| Edit : oops didn't read, too early |
|
| Back To Top | Reply Reply With Quote |
| 1 |