I am having a hard time creating a simple query.
I have two tables. "last_count" which has the columns "barcode" "location", and "count"
and "slow" which has columns "barcode" and "description".
The basic idea, is that "last_count" contains an inventory count of my entire catalog with seperate counts in different locations. "slow" is a list of slow moving items that I need to collect and remove from my inventory.
I came up with the following query to tell me where each item was, but there is a problem.
select RIGHT(S.barcode, 6), S.description, (select location from last_count where RIGHT(barcode,6) = RIGHT(S.barcode,6)) Location from slow s ;
That works, to a degree, as long as each item is only in one location. But, if widgetA is being stored in two different locations, that query only shows me the count at the first location. The second location is ignored.
Can anyone help me modify this query so that I get the counts from all locations where widgetA is stored?
thanks in advance.
Darron
I have two tables. "last_count" which has the columns "barcode" "location", and "count"
and "slow" which has columns "barcode" and "description".
The basic idea, is that "last_count" contains an inventory count of my entire catalog with seperate counts in different locations. "slow" is a list of slow moving items that I need to collect and remove from my inventory.
I came up with the following query to tell me where each item was, but there is a problem.
select RIGHT(S.barcode, 6), S.description, (select location from last_count where RIGHT(barcode,6) = RIGHT(S.barcode,6)) Location from slow s ;
That works, to a degree, as long as each item is only in one location. But, if widgetA is being stored in two different locations, that query only shows me the count at the first location. The second location is ignored.
Can anyone help me modify this query so that I get the counts from all locations where widgetA is stored?
thanks in advance.
Darron