Sign in to follow this  
shelter

Consulta Por Periodo De Data

Recommended Posts

Boa galera, estou efetuando uma consulta por periodo do tipo 10/04/2007 a 12/04/2007.... e não estou conseguindo.... erros:

Quando coloco ' ' da tipo de dados incompatives.

Quando coloco puro não aparece nada.

quando coloco # tambem não aparece nada ... tipo #10/04/2007# and #12/04/2007#

segue consulta abaixo:

Call abreConexao

strSQL = " SELECT Ramal.grupo , SUM (CRJJ04.duracao) AS total2 , COUNT (Ramal.grupo) AS total , AVG (CRJJ04.duracao) AS total3 , SUM (CRJJ04.duracao) AS total5 "

strSQL = strSQL & " FROM Ramal, CRJJ04 "

strSQL = strSQL & " where CRJJ04.origem=Ramal.Ramal "

strSQL = strSQL & " And tipo = 0 And servico = 1 and 2 "

strSQL = strSQL & " And data BETWEEN 10/3/2007 and 11/3/2007 "

strSQL = strSQL & " GROUP BY Ramal.grupo "

set rsDDD = conexaodb.execute(strSQL)

Boa galera obrigado hein...

Abraços

Valmir Lopes

Share this post


Link to post
Share on other sites

utilize between #"&datainicial&"# and #"&dayafina&"#

Share this post


Link to post
Share on other sites

Obrigado pela ajuda amigo, mais não deu certo... agora esta com o seguinte erro:

Tipo de erro:

Erro de compilação do Microsoft VBScript (0x800A0401)

Fim da instrução esperado

/atn2/fixa.asp, line 20, column 39

strSQL = strSQL & " And data between #"&10/3/2007&"# and #"&15/3/2007&"# "

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this