Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Seguer

    Last Date not showing the last date

    I solved it. In the end I used two queries; The first pulls out the names and daterange (date + time) The second runs on the first and pulls out the Max daterange for each person. I think the problem was still in the ID relationship. Thanks for all your help Golom.
  2. Seguer

    Last Date not showing the last date

    The extra records are not identical unfortunately, which is why I believe the problem lies in the MAX() aggregrate function. It SHOULD be working, I just don't know why it isn't. Here's some more sample data that your SQL returns: Assigned To Date_of_Update Time_of_Update David Yiu 8/22/2006...
  3. Seguer

    Last Date not showing the last date

    Thanks for the replay again Golom, I've been on holidays the past week which is why I haven't replied. Using this SQL seems to get me almost accurate results, save that it returns more than one record for each person (Assigned To). This would seem to me that it is not correctly selecting the...
  4. Seguer

    Last Date not showing the last date

    Sample data: Data_Tasks ID Assigned To 124 Bob 125 Bob 126 Bob 127 Jim 128 Sally 129 Sally 130 Jim 131 Sally 132 Bob 133 Jim 134 Jones 135 Jones 136 Jones...
  5. Seguer

    Last Date not showing the last date

    [Assigned To] is actually in a different table, "Data_Tasks" and I wasn't able to modify your SQL to incorporate that. Thanks for your efforts though! The two tables can be joined by Data_Tasks.ID and Data_Task_Update_History.task_ID
  6. Seguer

    Last Date not showing the last date

    Thanks Golom, that works as I worded it. Unfortunately for me, I worded my problem badly :) How do I separate this out for each person? In Data_Tasks I have an "Assigned To" field, and I need to get this max date/time for each person.
  7. Seguer

    Last Date not showing the last date

    I took a look at Max, but that won't work in getting me the time as well. Different dates will have different max times and such.
  8. Seguer

    Last Date not showing the last date

    Hi guys, I'm using Last to pull the latest date and time (separate fields) in a Many table, linked to a One table. 1: Data_Tasks Many: Data_Task_Update_History What I'm finding is that it is finding the date/time of the last record ID in Data_Task_Update_History, rather than the Last Date...
  9. Seguer

    Query to return TOP X results in a 1-M relationship

    Nevermind, had a brainstorm. To get tasks with no updates I added an "Or Is Null" after the subquery.
  10. Seguer

    Query to return TOP X results in a 1-M relationship

    Sorry to bother again, however this doesn't seem to pull out tasks that have no update. I think the logic behind that is because it is looking for ID's "in" a query result, when a task has no updates it's ID won't be there to be found. Is there any way around this?
  11. Seguer

    Query to return TOP X results in a 1-M relationship

    Ah, nevermind. I found the problem. I forgot to rename the SELECT TOP 2 ID to SELECT TOP 2 history_ID. It all works now. Thanks mp9. SELECT Data_Tasks.*, Data_Task_Update_History.* FROM Data_Tasks LEFT JOIN Data_Task_Update_History ON Data_Tasks.ID = Data_Task_Update_History.task_ID WHERE...
  12. Seguer

    Query to return TOP X results in a 1-M relationship

    Thanks for the reply mp9. The table structure is as follows: Data_Tasks ID .... Data_Task_Update_History history_ID task_ID date_of_update ... --------------------------------------- When I changed your code to reflect my table structure I get no results. When I changed it again to this...
  13. Seguer

    Query to return TOP X results in a 1-M relationship

    Hi guys, I have a 1-M relationship where 1 Task will have Many updates. In a query I need to get all Tasks within a criteria, but only the Top 2 updates. I also need to be able to show Tasks even if they have no updates. I think this is possible using the TOP predicate and subqueries, but for...

Part and Inventory Search

Back
Top