将不同的值从1列插入到另一列 [英] Inserting Distinct values from 1 Column to another Column
本文介绍了将不同的值从1列插入到另一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
i有2列如下,
hello all,
i have 2 columns as below,
ItemCode WareHouse
1001 1
1001 3
1001 5
1002 5
1002 4
1002 1
im使用Distinct选择itemCode
i m selecting the itemCode using Distinct
SELECT DISTINCT ItemCode FROM Table_Name
显示
which shows
ItemCode
1001
1002
现在我想插入针对WareHouse 10的不同数据
这应该看起来像
Now i want to insert distinct data against WareHouse 10
That should Look like
ItemCode WareHouse
1001 1
1001 3
1001 5
1001 10
1002 5
1002 4
1002 1
1002 10
谢谢。
Thanks.
推荐答案
这不是你想要的吗?
is this not what you want?
insert into YourTable
select distinct itemcode, 10 from YourTable
这篇关于将不同的值从1列插入到另一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文