Returning date from specific line in result

My query returns 4 to 6 lines per Doc_no. Each line represents a progression through the shop with each line having a start time and end time. In column "Description", One line is "Assembly", one is "Inspect", one is "Quote", one is "Ship" and so on. How do I modify the code to only look at the line that contains "Assembly", and return the end date for that line? My code looks something like this

select wh.doc_no
, wh.End date

from wo_hdr wh
join wo_hdr_status ws on (wh.doc_no = ws.doc_no)

where ws.wo_status_start date < ??the end date of the line were wh.Description = Assembly??

I'm a beginner as you can tell. Thanks for your help.

first to break your question

  1. to only look at the line that contains "Assembly", <- filter column that has 'Assembly'
  2. return the end date for that line <- choose the column that kept end date

so it will roughly looks like

select
wh.End date /point no.2/
from wo_hdr wh
join wo_hdr_status ws on (wh.doc_no = ws.doc_no)
where wh.Description = 'Assembly' /point no.1/

1 Like