-1

サブクエリprobを使用してテーブルに挿入するためのクエリがあります。サブクエリには2つの列があり、where条件とgroup by句があります。

サブクエリは正常に実行されています。だれか助けてください。plz

クエリ: Account_name はテキスト型です

insert into trial_bal (Account_name,Debit) values (

select convert(text,convert(varchar(max),Accounts)),SUM(ISNULL( Debit,0))-SUM( ISNULL(Credit,0)) 

from general

where Acount_Type='Assets'
group by convert(varchar(max),Accounts)
);
4

1 に答える 1

0

を使用する代わりに、select ステートメントから値を返すために使用INSERT INTO ..VALUESする必要があります。INSERT INTO .. SELECT..FROM

insert into trial_bal (Account_name,Debit)
select convert(text,convert(varchar(max),Accounts)),
  SUM(ISNULL( Debit,0))-SUM( ISNULL(Credit,0))
from general
where Acount_Type='Assets' 
group by convert(varchar(max),Accounts)
于 2013-04-22T23:22:26.117 に答える