我可以使用一些sql INSERT的帮助。SQL从另一张表插入
words_table contains productid word product table contains productid description
我想创造words_table行包含产品ID和产品表,其中描述LIKE“%关键字%”的每一行字“foundit” 。
我不知道该怎么做。
感谢
我可以使用一些sql INSERT的帮助。SQL从另一张表插入
words_table contains productid word product table contains productid description
我想创造words_table行包含产品ID和产品表,其中描述LIKE“%关键字%”的每一行字“foundit” 。
我不知道该怎么做。
感谢
试试这个:
INSERT INTO words_table (productId, word)
SELECT productId, 'foundit'
FROM product
WHERE description like '%keyword%'
INSERT INTO Words_table
SELECT ProductId, 'FoundIt'
FROM Product
WHERE Description LIKE '%keyword%'
INSERT words_table (productid, word)
SELECT productid, 'foundit'
FROM product
WHERE description LIKE '%' + @keyword + '%'
很酷 - 谢谢 – sdfor 2010-10-18 23:56:16
的作品就像一个魅力! – sdfor 2010-10-18 23:47:54