Ou use a clausula IN:
where STATUS in (1,7,8)
ou
where STATUS in ('1','7','8')
[ ]´s
Moacir
Robson escreveu:
Em firebird separe as clausulas where com parenteses tipo:
... where (STATUS = 1) OR (STATUS = 7) OR (STATUS=8)
ou
... where (STATUS = '1') OR (STATUS = '7') OR (STATUS='8')
Como o Edson informou este segundo se STATUS for alfanumerico, varchar, e
etc...
Kaputz, Robson
Skype: kaputz_gri
Keep the Dream Alive
- Mensagem original
De: Edison DRP [EMAIL PROTECTED]
Para: delphi-br@yahoogrupos.com.br
Enviadas: Domingo, 21 de Outubro de 2007 12:15:07
Assunto: Re: [delphi-br] Dúvida com query
Select .. where Status = '1' OR status = '7' e usar aspas se 1 e 7
não forem valores numérciso
Edison
- Original Message -
From: Ralp Alves Bezerra [EMAIL PROTECTED] .com.br
To: Delphi BR [EMAIL PROTECTED] os.com.br
Sent: Sunday, October 21, 2007 10:09 AM
Subject: [delphi-br] Dúvida com query
Nobres colegas,
Preciso listar em uma consulta os alunos que tenham o status igual a 1,
7 e 8 somente. Porém a consulta não retorna os dados solicitados.
Já tentei trocar a linha:
Sql.Add('Status= 1 and Status=7 and Status=8 and');
por :
Sql.Add('Status= 1 or Status=7 or Status=8 and'); mas não funciona.
Alguém poderia me dar uma luz.
Grato
estou com uma dúvida nesta consulta abaixo:
If Radio1.ItemIndex= 12 then // Turma da Escola
Begin
With qrPesqAluno do
Begin
Close;
Sql.Clear;
Sql.Add('Select * From Alunos');
If All.Checked= False then
Begin
Sql.Add('Where CodigoDaEscola= :CodEsc and');
Sql.Add('Status= 1 and Status=7 and Status=8 and');
dúvida nesta linha
Sql.Add('TipoDeEnsi noD=:TE and');
Sql.Add('TurmaD= :TR and');
Sql.Add('SerieD= :SE and');
Sql.Add('TurnoD= :TU');
Sql.Add('Order By Nome');
ParamByName( 'CodEsc') .Value:=rxdbLook upCombo9. Text;
ParamByName( 'TE').Value :=rxdbLookupCombo21 .Text;
ParamByName( 'TR').Value :=rxdbLookupCombo12 .Text;
ParamByName( 'SE').Value :=rxdbLookupCombo13 .Text;
ParamByName( 'TU').Value :=rxdbLookupCombo14 .Text;
end else begin
Sql.Add('Where TipoDeEnsinoD= :TE and');
Sql.Add('TurmaD= :TR and');
Sql.Add('SerieD= :SE and');
Sql.Add('TurnoD= :TU');
Sql.Add('Order By Nome');
ParamByName( 'TE').Value :=rxdbLookupCombo21 .Text;
ParamByName( 'TR').Value :=rxdbLookupCombo12 .Text;
ParamByName( 'SE').Value :=rxdbLookupCombo13 .Text;
ParamByName( 'TU').Value :=rxdbLookupCombo14 .Text;
end;
Open
end;
if qrPesqAluno. IsEmpty Then ShowMessage( 'Registro não encontrado!' )
end;
--
FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM
Links do Yahoo! Grupos
Abra sua conta no Yahoo! Mail, o único sem limite de espaço para
armazenamento!
http://br.mail.yahoo.com/
[As partes desta mensagem que não continham texto foram removidas]
[As partes desta mensagem que não continham texto foram removidas]