Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
select orderstage_id,process_date from orderhistory
where orderstage_id in (select orderstage_id from orderhistory
where orderinfo='reprocessed') and orderinfo!='reprocessed'
select orderstage_id,process_date from orderhistory
where orderstage_id in (select orderstage_id from orderhistory
where orderinfo='reprocessed') and orderinfo!='reprocessed'
Your query doesn't take into consideration neither cardinality nor order. You cannot just assume there are two rows per orderstage_id.
How do you know returned row/rows is/are the next to "reprocessed" row?
1- Your query has the potential to return multiple rows
2- Your query has the potential to return rows before/after "reprocessed" row
Better to wait for OP to clarify scenario... then try to help him/her.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
He/she's the person who knows what he wants. Whatever info i've now i tried to put them together and the other logic he/she can take care of. I would appreciate if you do not advice, when to help others.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Tell us please what u mean by "next row"?
How are they ordered so that we know what is "next"
Support malay_biswal, from what u have posted seems that either u have just 2 rows per ID or u do not know what u need
sorry if i was not clear earlier ..in the history table i have will have rows for every stage like every order goes through 10 different stages from ordering to complete.
i believe the query works when we have only 2 rows in the table but we have more.
I am looking for a query next to reprocessed row.it's always the next row and some one can reprocess an order any time.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Bookmarks