Re: help with sql query

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Something like the following query ***might*** work for you.

SELECT *
FROM TABLE as T
WHERE PMDate =
(SELECT Max(PMDATE)
FROM TABLE as Temp
WHERE Temp.[Tool#] = T.[Tool#])
OR T.[Est Comp Date] =
(SELECT Min([Est Comp Date])
FROM Table as Temp2
WHERE Status = "Done" AND
Temp2.[Tool#] = T.[Tool#] AND
Temp2.[Est Comp Date] >=
(SELECT Max(PMDATE)
FROM TABLE as Temp3
WHERE Temp3.[Tool#] = Temp2.[Tool#]))

<ifoundgoldbug@xxxxxxxxx> wrote in message
news:1153156879.249940.72900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Greetings

I have a table arranged thusly

Reason Status Est Comp Date PMDate Tool#
7/14/06
WFT083
Maintence done 7/16/06 WFT083

what my sql statement MUST do is search by Tool # then find the most
recent PMDate then find if there is a work order with finished
maintence with a complete date AFTER the PMdate. also the returning
record will be a seperate record from the one with the PM date.

thanks for your help.



.



Relevant Pages

  • help with sql query
    ... Reason Status Est Comp Date PMDate Tool# ... what my sql statement MUST do is search by Tool # then find the most ... record will be a seperate record from the one with the PM date. ...
    (microsoft.public.access.queries)
  • help with sql statement
    ... what my sql statement MUST do is search by Tool # then find the most ... maintence with a complete date AFTER the PMdate. ... record will be a seperate record from the one with the PM date. ...
    (microsoft.public.access.formscoding)