DavidT_macktool
Well-known member
I have a table like this:
ShopFloorID = autoincrement key field
ShopNumber = integer
ShopNumberOpen = boolean
PartID = integer
OperationNumber = integer
OperationComplete = boolean
ShopNumber can have Multiple PartId's
PartID can have Multiple OperationNumbers
OperationComplete = False if the operation hasn't been run yet.
I want to Select the first Operation that OperationComplete = False for all part numbers
when ShopNumberOpen = True.
example data in above order:
12342 100 false 1 10 true
12343 100 false 1 20 true
12344 100 false 2 10 true
12345 101 true 1 10 true
12346 101 true 1 20 true
12347 101 true 1 30 true
12348 101 true 1 40 false
12349 102 true 2 10 false
12350 102 true 2 20 false
12351 102 true 2 30 false
12352 103 true 1 10 true
12353 103 true 1 20 false
12354 103 true 1 30 false
select:
12348 101 true 1 40 false
12349 102 true 2 10 false
12353 103 true 1 20 false
"Show me the current OperationNumber for all Part Numbers of open Shop Numbers in the shop."
Can anone help, Combination of Select DISTINCT and Select TOP 1?
ShopFloorID = autoincrement key field
ShopNumber = integer
ShopNumberOpen = boolean
PartID = integer
OperationNumber = integer
OperationComplete = boolean
ShopNumber can have Multiple PartId's
PartID can have Multiple OperationNumbers
OperationComplete = False if the operation hasn't been run yet.
I want to Select the first Operation that OperationComplete = False for all part numbers
when ShopNumberOpen = True.
example data in above order:
12342 100 false 1 10 true
12343 100 false 1 20 true
12344 100 false 2 10 true
12345 101 true 1 10 true
12346 101 true 1 20 true
12347 101 true 1 30 true
12348 101 true 1 40 false
12349 102 true 2 10 false
12350 102 true 2 20 false
12351 102 true 2 30 false
12352 103 true 1 10 true
12353 103 true 1 20 false
12354 103 true 1 30 false
select:
12348 101 true 1 40 false
12349 102 true 2 10 false
12353 103 true 1 20 false
"Show me the current OperationNumber for all Part Numbers of open Shop Numbers in the shop."
Can anone help, Combination of Select DISTINCT and Select TOP 1?