ERRO EM COMANDO SQL
Bom dia!!!!!
Meu seguinte comando:
"select sum(qtdnf) as qtdtt, npi from tpiEntrega where npi = (select npedido from tpi where mesref between " & MSKmes.Text & " and " & MSKmesr.Text & " and codigocli = '" & cmbcliente.ItemData(cmbcliente.ListIndex) & "') group by npi"
retorna uma mensagem de erro:
"No máximo um registro pode ser retornado por esta subconsulta"
Se alguem souber o que pode ser me de um toque!!!
Desde de já obrigado.....[S20]
Meu seguinte comando:
"select sum(qtdnf) as qtdtt, npi from tpiEntrega where npi = (select npedido from tpi where mesref between " & MSKmes.Text & " and " & MSKmesr.Text & " and codigocli = '" & cmbcliente.ItemData(cmbcliente.ListIndex) & "') group by npi"
retorna uma mensagem de erro:
"No máximo um registro pode ser retornado por esta subconsulta"
Se alguem souber o que pode ser me de um toque!!!
Desde de já obrigado.....[S20]
Tente assim, e veja se dá certo:
select sum(qtdnf) as qtdtt, npi from tpiEntrega where npi = (select npedido from tpi where mesref between " & MSKmes.Text & " and " & MSKmesr.Text & " and codigocli = '" & cmbcliente.ItemData(cmbcliente.ListIndex) & "') group by npi, sum(qtdnf)
select sum(qtdnf) as qtdtt, npi from tpiEntrega where npi = (select npedido from tpi where mesref between " & MSKmes.Text & " and " & MSKmesr.Text & " and codigocli = '" & cmbcliente.ItemData(cmbcliente.ListIndex) & "') group by npi, sum(qtdnf)
Tópico encerrado , respostas não são mais permitidas