SQL Query structure
I have a table called Orders Like So:
OrderItemID CustomerIDNumber OrderProcessed
1 9212060068089 False
2 6412180017080 False
3 9212060068089 False
4 5508245127003 False
5 9212060068089 False
What I would like to do, and it seems to me that I am really struggling with the correct one, is to select all unique client ID numbers where the processed request is false.
Now this is easy to do using DISTINCT, but the TRICKY PART I'm struggling with is that I WANT the customer ID numbers that still retain their order in terms of the order ID. So the sample output should be:
CustomerIDNumber OrderProcessed
9212060068089 False
6412180017080 False
5508245127003 False
PLEASE NOTE: ALL VALUES IN THE ORDERING PROCESS ARE EASY HERE, VERY IN MY TABLE, THERE WILL BE SOME TRUE VALUES FOR PROCESSING THE ORDER.
Here is the WRONG OUTPUT I am currently getting:
CustomerIDNumber OrderProcessed
5508245127003 False
6412180017080 False
9212060068089 False
As you can see, it sorts the customer ID in ascending order, which is NOT what I want.
+3
source to share