This is a bit of an SQL nut (at least to me).
I want to find the SQL statement that gets the next unused number within that category.
Simplified Table:
Table name: MyUnit.
Attributes:
-UnitNo
-CategoryNo
Let's assume the statement
SELECT UnitNo FROM MyUnit WHERE (CategoryNo=@Category)
returns the set {1,2,3,4,5,7,8,10,11,12} if Category=3.
I want to find the SQL statement that have two parameters: "Category" and "MinimumNo"
Examples:
"Category" = 3
"MinimumNo" = 2 should return 6
"Category" = 3
"MinimumNo" = 5 should return 6
"Category" = 3
"MinimumNo" = 7 should return 9
"Category" = 3
"MinimumNo" = 12 should return 13
"Category" = 3
"MinimumNo" = 17 should return 17
I hope I don't have to create a separate table containing all valid Unit numbers...
I want to find the SQL statement that gets the next unused number within that category.
Simplified Table:
Table name: MyUnit.
Attributes:
-UnitNo
-CategoryNo
Let's assume the statement
SELECT UnitNo FROM MyUnit WHERE (CategoryNo=@Category)
returns the set {1,2,3,4,5,7,8,10,11,12} if Category=3.
I want to find the SQL statement that have two parameters: "Category" and "MinimumNo"
Examples:
"Category" = 3
"MinimumNo" = 2 should return 6
"Category" = 3
"MinimumNo" = 5 should return 6
"Category" = 3
"MinimumNo" = 7 should return 9
"Category" = 3
"MinimumNo" = 12 should return 13
"Category" = 3
"MinimumNo" = 17 should return 17
I hope I don't have to create a separate table containing all valid Unit numbers...