I am trying to assign a value to a row based on the value of a field in the previous row. In this case, I am able to identify where first left character of the item number of the previous row is 5. When this is true I need to display the value of the meal_typ
field in each succsessive row until the condition is met again. So far the only thing that I have managed to do is pass the value to the first line.
I'm just not sure how to approach this issue. Perhaps there is a way to set a field in the main query equal to the result of the case in the subquery? Or perhaps there is a way to assign a variable to the subquery and set another variable equal to it
in the main query? I haven't been able to make it work yet but I believe that there must be a way.
I am not able to use a stored procedure for this because I need to post this in our ERP systems "sql query requester" which does not recognize references to a stored procedure.
Here is the query i am using now and a sample of the current result set:
select cur.line_nbr, cur.item_nbr, cur.meal_typ,
(select case when left<
View Complete Post