G
Garry
I am trying to write a query for a colleague to pull out some data into an
excel file.
He is using a database which logs enquiries / quotes issued. However under
the detail section of the quote someone hase been entering "As Above" in the
part number field. This looks fine on the form view, but when pulled out
into excel obviously is of no use.
The relevant parts of the table are as follows:
LineID QuoteNo Item Part
1 100 1 Apple
2 100 2 As Above
3 101 1 Banana
4 102 1 Orange
5 102 2 Grape
6 102 3 As Above
7 102 4 As Above
I am trying to write a query to find the correct Part value when As Above
has been entered.
The logic is quite simple: If the Part value for LineID is "As Above",
lookup the Part value for LineID-1, then LineID-2 etc until you find the a
Part Value which is not "As Above". This will then be the correct Part
value.
Can something like this be done in SQL, or is there another way of acheiving
this result?
Any ideas appreciated.
Thanks,
Garry.
excel file.
He is using a database which logs enquiries / quotes issued. However under
the detail section of the quote someone hase been entering "As Above" in the
part number field. This looks fine on the form view, but when pulled out
into excel obviously is of no use.
The relevant parts of the table are as follows:
LineID QuoteNo Item Part
1 100 1 Apple
2 100 2 As Above
3 101 1 Banana
4 102 1 Orange
5 102 2 Grape
6 102 3 As Above
7 102 4 As Above
I am trying to write a query to find the correct Part value when As Above
has been entered.
The logic is quite simple: If the Part value for LineID is "As Above",
lookup the Part value for LineID-1, then LineID-2 etc until you find the a
Part Value which is not "As Above". This will then be the correct Part
value.
Can something like this be done in SQL, or is there another way of acheiving
this result?
Any ideas appreciated.
Thanks,
Garry.