I've never been good in queries. So a little help is much appreciated. It's even difficult to explain what I need.
A sample database is attached if you need to see the situation.
This is the relationship between 4 tables in the sample database :
Imagine the database controls a production line.
In another word I need a list of orders that their records in tblOrdersProgress has the following two conditions:
I know I should explain it better, but with my level of English I couldn't manage to write it better.
I appreciate any kind of advice.
A sample database is attached if you need to see the situation.
This is the relationship between 4 tables in the sample database :
Imagine the database controls a production line.
- There are 11 possible processes that each order can go through (list of processes are in tblProecesses).
- A list of necessary processes for each product is registered in tblOrderProgress.
- When a process is done, tblOrderProgress will be updated : Which Order(OrderFK), which process(ProcessFK), who done it (UserFK) and when done(RegisteredOn).
- When a product is finished tblOrderProgress will be updated: Which Order(OrderFK), ProcessFK=11, who done it (UserFK) and when Delivered (RegisteredOn).
Note: Delivery's ProcessFK is 11.
Hence ProcessFK=11 AND RegisteredOn=Null means that order is not finished yet.
In another word I need a list of orders that their records in tblOrdersProgress has the following two conditions:
- RegisteredOn for ProcessFK=3 is Null
- RegisteredOn for ProcessFK=11 is Null
I know I should explain it better, but with my level of English I couldn't manage to write it better.
I appreciate any kind of advice.