rgb192
asked on
sql server for loop
INSERT INTO newTable
SELECT
(SELECT zip from orders where orderid = x ) as Zip,
(SELECT title from products where productid = x ) as Title,
(select description from accessory where accessoryid = x ) as description
could this be put into a for loop and all the values of the table populated
SELECT
(SELECT zip from orders where orderid = x ) as Zip,
(SELECT title from products where productid = x ) as Title,
(select description from accessory where accessoryid = x ) as description
could this be put into a for loop and all the values of the table populated
can you give us more details?
table structures with sample data and what you want to do with the data?
table structures with sample data and what you want to do with the data?
ASKER
>>select zip, title, description
from zip, products, accessory
where orderid= x and productid = x and accessoryid= x
but x would be orderid
and orderid goes from 1 to 1000
from zip, products, accessory
where orderid= x and productid = x and accessoryid= x
but x would be orderid
and orderid goes from 1 to 1000
THEN DESCRIBE YOUR PROBLEM BETTER.
can you provide us with the table structures along with the foreign key columns or relations between the tables marked?
ASKER
>>can you provide us with the table structures along with the foreign key columns or relations between the tables marked?
not sure
not sure
Tim out.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you provide sample set and expected result?
ASKER
thanks
select zip, title, description
from zip, products, accessory
where orderid= x and productid = x and accessoryid= x