从另一个表创建表的问题 [英] problem in creating a table from another table

查看:59
本文介绍了从另一个表创建表的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一张名为Depot_Id&的2列表Depot_Name,我必须从插入Depot_Name的值中创建另一个表作为新表的列。



我对此没有任何想法...

请建议我解决此问题。



这是仓库表: -



Depot_Id Depot_Name





1 A

2 B

3 C



现在我需要另一个表,其中列名为shuold b A,B和C ..

Hi all,

I have a table with 2 columns named Depot_Id & Depot_Name, i have to make another table from the values inserted into Depot_Name as the columns of new table.

I dont have any idea for that...
kindly suggest me solution for this.

this is Depot Table:-

Depot_Id Depot_Name


1 A
2 B
3 C

Now i need another table in which column name shuold b A,B and C..

推荐答案

您不需要创建另一个表来仅获取Depatment名称。您可以点击 SELECT [ ^ ]这些值使用查询:

You don''t need to create another table to get only Depatment names. You can simle SELECT[^] these values using query:
SELECT DepName
FROM YourTable
ORDER BY DepName





但是如果真的想创造新的表,请参考以下链接:

创建表 [< a href =http://msdn.microsoft.com/en-us/library/ms174979.aspxtarget =_ blanktitle =新窗口> ^ ]

INSERT语句(T-SQL) [ ^ ]





But if really want to create new table, please, refer below links:
CREATE TABLE[^]
INSERT statement (T-SQL)[^]

INSERT INTO NewTable (DepName)
SELECT DepName
FROM YourTable
ORDER BY DepName


这篇关于从另一个表创建表的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆