与查询相关的SQL查询?

时间:2015-07-31 06:33:15

标签: sql sql-server sql-server-2008 join

Select * 
into relatesupply 
from
    OrderByStore m 
m.Product_Name,m.Quantity,n.Quantity 
inner join 
    presentsupply n on m.Product_Name = n.Product_Name 

我希望relatesupply作为新表,加入输出将存储在relatesupply?我应该如何解雇查询? OrderByStorepresentsupply是两个表的位置

4 个答案:

答案 0 :(得分:3)

查询将根据您的需要使用内部联接TextField { id: textField1 x: 25 y: 163 width: 62 height: 30 font.pixelSize: 20 placeholderText: qsTr("Text Field") style: TextFieldStyle { textColor: "black" background: Rectangle { radius: 2 color: "transparent" Rectangle { width: parent.width height: parent.height / 2 border.width: 1 anchors.bottom: parent.bottom radius: 2 border.color: "steelblue" } } } } relatesupply创建一个表OrderByStore

presentsupply

enter image description here

答案 1 :(得分:1)

提前创建表(手动或脚本),然后使用insert语句插入数据。避免使用*来选择列,命名它们。在我看来,这是一种更简洁的做事方式。

答案 2 :(得分:0)

insert into Relatesupply 
    select * 
    from OrderByStore m 
    join Presentsupply n on (Select * into  relatesupply  
                             from OrderByStore m  
                                  m.Product_Name,m.Quantity,n.Quantity  
                             inner join presentsupply n on m.Product_Name = n.Product_Name);

此查询应该有效。

答案 3 :(得分:0)

试试这个:

select * 
into Relatesupply
from 
(
  select m.Product_Name,m.Quantity,n.Quantity 
  from OrderByStore m 
  inner join presentsupply n on m.Product_Name = n.Product_Name
) as X
相关问题