Update dinâmico problemático
Caros amigos de profissão , gostaria que alguém me ajuda-se no seguinte problema.
Tenho duas tabelas em um banco interbase ex: Notas,Tempor
três chaves primárias para ambas as tabelas os nomes são iguais
(nr_mat,cd_disc,ano_atual) todas varchar
gostaria de atualizar dinamicamente os dados da tabela tempor com cálculos de notas da tabela Notas, o que aconteceu foi o seguinte houve uma tentativa de atualização de múltiplas linhas em um único registro (multiple rows in a singleston select)
o comando foi o seguinte ( será necessário fazer isso dinamicamente )
Update tempor set nota = ( select (nota.ap1+2*pb1)/3 from nota,tempor where (nota.nr_mat = tempor.nr_mat) and
(nota.cd_disc = tempor.cd_disc) and
(nota.ano_atual = tempor.ano_atual))
where tempor.nr_mat = ( select nr_mat from nota,tempor where (nota.nr_mat = tempor.nr_mat) and
(nota.cd_disc = tempor.cd_disc) and
(nota.ano_atual = tempor.ano_atual))
and tempor.cd_disc = ( select cd_disc from nota,tempor where (nota.nr_mat = tempor.nr_mat) and
(nota.cd_disc = tempor.cd_disc) and
(nota.ano_atual = tempor.ano_atual))
and tempor.ano_atual = ( select ano_atual from nota,tempor where (nota.nr_mat = tempor.nr_mat) and
(nota.cd_disc = tempor.cd_disc) and
(nota.ano_atual = tempor.ano_atual))
Tenho duas tabelas em um banco interbase ex: Notas,Tempor
três chaves primárias para ambas as tabelas os nomes são iguais
(nr_mat,cd_disc,ano_atual) todas varchar
gostaria de atualizar dinamicamente os dados da tabela tempor com cálculos de notas da tabela Notas, o que aconteceu foi o seguinte houve uma tentativa de atualização de múltiplas linhas em um único registro (multiple rows in a singleston select)
o comando foi o seguinte ( será necessário fazer isso dinamicamente )
Update tempor set nota = ( select (nota.ap1+2*pb1)/3 from nota,tempor where (nota.nr_mat = tempor.nr_mat) and
(nota.cd_disc = tempor.cd_disc) and
(nota.ano_atual = tempor.ano_atual))
where tempor.nr_mat = ( select nr_mat from nota,tempor where (nota.nr_mat = tempor.nr_mat) and
(nota.cd_disc = tempor.cd_disc) and
(nota.ano_atual = tempor.ano_atual))
and tempor.cd_disc = ( select cd_disc from nota,tempor where (nota.nr_mat = tempor.nr_mat) and
(nota.cd_disc = tempor.cd_disc) and
(nota.ano_atual = tempor.ano_atual))
and tempor.ano_atual = ( select ano_atual from nota,tempor where (nota.nr_mat = tempor.nr_mat) and
(nota.cd_disc = tempor.cd_disc) and
(nota.ano_atual = tempor.ano_atual))
Fabiocor
Curtidas 0