I have a factory table with factoryname: select factoryname from factory
I then have a products table: select productcode from products
I want to create a list that has products for all factory.
so output :
mill 1 product 1
mill 1 product 2
mill 1 product 3
mill 2 product 1
mill 2 product 2
mill 2 product 3
mill 3 product 1
mill 3 product 2
mill 3 product 3
I have something like this:
DECLARE @numrows int
DECLARE @i int
DECLARE @department int
SET @numrows = (SELECT COUNT(*) FROM factory)
WHILE (@i <= @numrows)
BEGIN
SELECT factoryname,product FROM products,factory )
SET @i = @i + 1
END
I am obviously off the mark, here, any advice? Thanks as always.