G
Guest
I was wondering if there is a way to stop a query as soon as it finds the
first answer.
for example I have a table with numberous items and locations and qty's
such as
item 1 location 11 qty 22
item 2 location 33 qty 44
item 3 location 44 qty 34
I want the query to find the combination of items that will result qty=100
(qty+qty+qty)
however the items must not be the same and the locations must not be the
same as well
As I have it now it returns
item 1 location 11 qty 22 item 2 location 33 qty 44 item 3 location 44 qty34
item 1 location 11 qty 22 item 3 location 44 qty 33 item 2 location 33 qty 44
item 2 location 33 qty 44 item 1 location 11 qty 22 item 3 location 44 qty 34
and so on
I want it to show only the first result not every single combination.
In this example there will not be too many combination but in my real table
there are over 1500 items and 2600 locations. I have restricted the data as
much as possible but still am getting over 60,000 results (which as you would
imagine takes awhile to run). Is it possible to stop running as soon as it
finds the first answer
Any help would be helpful
first answer.
for example I have a table with numberous items and locations and qty's
such as
item 1 location 11 qty 22
item 2 location 33 qty 44
item 3 location 44 qty 34
I want the query to find the combination of items that will result qty=100
(qty+qty+qty)
however the items must not be the same and the locations must not be the
same as well
As I have it now it returns
item 1 location 11 qty 22 item 2 location 33 qty 44 item 3 location 44 qty34
item 1 location 11 qty 22 item 3 location 44 qty 33 item 2 location 33 qty 44
item 2 location 33 qty 44 item 1 location 11 qty 22 item 3 location 44 qty 34
and so on
I want it to show only the first result not every single combination.
In this example there will not be too many combination but in my real table
there are over 1500 items and 2600 locations. I have restricted the data as
much as possible but still am getting over 60,000 results (which as you would
imagine takes awhile to run). Is it possible to stop running as soon as it
finds the first answer
Any help would be helpful