Here is the situation-our app is not completing a process reliably. We have shipment and task tables, headers and lines in separate tables.
When shipment is in the header and lines table and the status of the header is 2- then I need to compare the lines of that shipment in lines_table with lines of that same shipment in task_table where the tsk_type = 13.
Below is what I have so far. I know it is wrong- I thought showing it might help explain where I am trying to get. I am not a programmer.
select * from d.task_table where tsk_ord_sur in (select order_surrogate from d.order_table where order_lines <> (select count(*)from d.task_table where (tsk_tp = '13')))
But this does not get me only orders that are in status 2- and it compares the # of lines =13 in the whole table- not just the lines for that order.
Let me know if you need more info. I appreciate your time.
Thanks in advance,
Tracie
When shipment is in the header and lines table and the status of the header is 2- then I need to compare the lines of that shipment in lines_table with lines of that same shipment in task_table where the tsk_type = 13.
Below is what I have so far. I know it is wrong- I thought showing it might help explain where I am trying to get. I am not a programmer.

select * from d.task_table where tsk_ord_sur in (select order_surrogate from d.order_table where order_lines <> (select count(*)from d.task_table where (tsk_tp = '13')))
But this does not get me only orders that are in status 2- and it compares the # of lines =13 in the whole table- not just the lines for that order.
Let me know if you need more info. I appreciate your time.
Thanks in advance,
Tracie