question

Yan0609 avatar image
Yan0609 asked

sql command

Table:product product_id parent_id 966 0 If the table value like this insert row and value into Table:custom
t-sqlinsert
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Usman Butt avatar image
Usman Butt answered
Seems like you need something like the following INSERT custom (COL1NAME, COL2NAME....OTHER COLUMNS) SELECT product_id, parent_id... OR ANY COLUMNNAMES FROM product WHERE product_id = 966 AND parent_id = 0
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Yan0609 avatar image Yan0609 commented ·
If I don,t kNow which project id I just want to insert. The Id which is parent id =0
0 Likes 0 ·
Usman Butt avatar image Usman Butt commented ·
@Yan0609 Can you please give some test data and desired output to sort this out? But if I understand you correctly, you mean you just need to insert those rows where parentid = 0, then change the WHERE clause from `WHERE product_id = 966 AND parent_id = 0` to `WHERE parent_id = 0`
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.