2013-12-19 16 views
0

我做錯了什麼在查詢文件的這一部分:在查詢部分錯誤messase:列列出或自定義序列應指定

CREATE TABLE LR_Charts; 
    INSERT INTO TABLE LR_Charts 
    select campid,CampNum,Count,Legend from tmp_LRchart1 Order By CampNum; 

    ALTER TABLE LR_Charts ADD COLUMNS (CountCumm INT); 


    Select tmp_LRchart1.campid, tmp_LRchart1.Count, SUM(LR_Charts.Count) 
    as LR_Charts.CountCumm from tmp_LRchart1, LR_Charts 
    where tmp_LRchart1.campid >= LR_Charts.campid 
    group by tmp_LRchart1.campid order by tmp_LRchart1.campid; 

請幫助。

回答

1

聲明

CREATE TABLE LR_Charts; 

是錯誤的。

您正在嘗試創建表而未指定列的列表。
它應該是這樣的:

CREATE TABLE LR_Charts(i int, v varchar(10)); 

但看你的陳述我的理解是,
你要創建一個表與另一個表中的數據。
如果這是正確的,那麼你的查詢應該是這樣的:

CREATE TABLE LR_Charts AS 
select campid,CampNum,Count,Legend from tmp_LRchart1 Order By CampNum;