Link to home
Start Free TrialLog in
Avatar of JDay2
JDay2

asked on

using an update statement with 3 tables but need to get minimum receipt date need help finishings

I have the following sql update statement but need to get the minimum receipt date

update s
set s.SRequestStatusID = '10'
from servicerequest s
inner join servicerequestaddfru s1
on s.srequestid = s1.srequestid
inner join Frus s2
on s1.FrusID= s2.FrusID
where s.OrderTypeID = '12' and s1.LineStatusID ='8' and s2.PartNumber=@FrusPartNumber
and SerialNo=@SerialNo and s.CustomerID=@CustomerID and s2.Repairable=0 
and s1.ReceiptDate = (SELECT MIN(ReceiptDate)
					  from servicerequestaddfru s3
					  where

Open in new window

I tried to finish the statement but don't know if I am on the right track.  I have multiple lines that have the same a part number with serial number = NONE that are available and I need to only select the minimum receipt date to close.  Ignore the parameters
ASKER CERTIFIED SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JDay2
JDay2

ASKER

This closed out all the lines in which I need to only close the oldest
Mind that we don't know your table structures and you didn't also provide any sample data so all that we can do is guess.
If you provide the necessary information we'll be able to help you better.
Avatar of JDay2

ASKER

This did work.  There was another line of code that was changing the status of all the requests.