September 14, 2009 at 10:20 am
I am trying to enter data into product id's that correspond to a category id in a different database and can't figure out the syntex. This is what I have, can anyone help get me on the right track.
Thank you
select into js_vm_product as js (product_length,product_width,product_height)
values (1,1,1)
where categoryid = 18
join js_vm_product_category_xref as jsc
on js.productid = jsc.productid
September 14, 2009 at 10:32 am
It's difficult to be sure what you're after without posting the create table statements and giving some sample data (I'm sure someone will be along to post a link to the proper way to ask questions on this forum shortly), but does this help you out:
update js
set product_length=1,
product_width=1,
product_height=1
from
js_vm_product js
Inner Join
js_vm_product_category_xref jsc on js.productid = jsc.productid
where categoryid = 18
SELECT INTO is only really used as a quick way to create a new table from a select statement (or in some specialised circumstances to avoid excessive logging), it sounds like UPDATE is what you need here.
September 14, 2009 at 11:37 am
HowardW (9/14/2009)
It's difficult to be sure what you're after without posting the create table statements and giving some sample data (I'm sure someone will be along to post a link to the proper way to ask questions on this forum shortly), but does this help you out:
The article Howard is referring to is in my signature on 'How to post Sample Data'.
That said, I think you're looking for something more like this:
select 1,1,1
into Newtable
from js_vm_product js
inner join js_vm_product_category_xref as jsc on js.productid = jsc.productid
where categoryid = 18
September 14, 2009 at 12:29 pm
Thank you for your support, I will read your article before I post again.
Doug
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply