我正在研究在SQL查询向导中创建临时表。如何从临时表中选择一列(或多列)数据?
如果我尝试从临时表中选择一列,我会得到一个“List index of of bounds(1)”错误。如果我尝试从临时表中选择两列,我会得到一个 “列出索引越界(2)”
:::::::::::::::这个查询运行::::::::::::::
SELECT Arfile.PATIENT_NO Patient_no,
Arfile.CHARGE_NO Charge_no,
Arfile.CHARGE_SEQ Charge_seq,
Arfile.ADJUST_TYPE Adjust_type,
Arfile.AMOUNT Amount,
Arfile.CHARGE_AMOUNT Charge_amount,
Arfile.PAYMENT_AMOUNT Payment_amount,
Arfile.ADJUSTMENT_AMOUNT Adjustment_amount,
Arfile.PAYMENT_TYPE Payment_type
INTO #testing1
FROM dbo.ARFILE Arfile
Select *
from #testing1
drop table #testing1
::::::::::::::这个查询出错了::::::::
SELECT Arfile.PATIENT_NO Patient_no,
Arfile.CHARGE_NO Charge_no,
Arfile.CHARGE_SEQ Charge_seq,
Arfile.ADJUST_TYPE Adjust_type,
Arfile.AMOUNT Amount,
Arfile.CHARGE_AMOUNT Charge_amount,
Arfile.PAYMENT_AMOUNT Payment_amount,
Arfile.ADJUSTMENT_AMOUNT Adjustment_amount,
Arfile.PAYMENT_TYPE Payment_type
INTO #testing1
FROM dbo.ARFILE Arfile
Select Patient_no
from #testing1
drop table #testing1
您使用的是哪个DBMS? 数据存储在SQL服务器中,我使用的是名为QS Reporter的SQL编译器。
确切的错误信息是什么? 我在此帖中列出了以前的确切错误消息。
这是什么“SQL查询向导”的事情? QS记者。
::::此查询出错::::
SELECT Arfile.PATIENT_NO
INTO #testing1
FROM dbo.ARFILE
Select *
from #testing1
drop table #testing1
::::此查询获取错误“list index out of bounds(4)”::::::
SELECT Arfile.PATIENT_NO Patient_no,
Arfile.CHARGE_NO Charge_no,
Arfile.CHARGE_SEQ Charge_seq,
Arfile.ADJUST_TYPE Adjust_type
INTO #testing1
FROM dbo.ARFILE Arfile
Select *
from #testing1
drop table #testing1
::::此查询有效::::
SELECT Arfile.PATIENT_NO Patient_no,
Arfile.CHARGE_NO Charge_no,
Arfile.CHARGE_SEQ Charge_seq,
Arfile.ADJUST_TYPE Adjust_type,
Arfile.AMOUNT Amount
INTO #testing1
FROM dbo.ARFILE Arfile
Select *
from #testing1
drop table #testing1
答案 0 :(得分:0)
如果我没有弄错,你必须像Arfile.PATIENT_NO AS Patient_no和其他所有人一样使用“AS”。