desculpe não ter dado mais informações;
  uso o MSSQLSERVER 2000
  agora eu tirei o AS e quando tento mudar de FALSE para TRUE no TSQLQuery
  dá o erro SQL State: 42000. Sql Error Code:170
  line 1: Incorrect sintax near ','.
  
  grato
  Stainle

Welson Avelar <[EMAIL PROTECTED]> escreveu:
  Bom, mesmo não sabendo que BD você está usando (e nem a mensagem de erro), vou tratar com sendo o FB.

Quando usar funções do SQL (Sum, Avg, Count),  não use da forma que você está usando "sum(mat.tnotto) as Matriz". Tire o "AS" e tente novamente.

[]'s.

[-----x-----]
stainle2003 escreveu:

Boa Tarde, utilizo em Query(BDE DBTables) do delphi 5 a sintaxe que
pretendo transferir para o TSQLDataSet do DBExpress, porém dá um erro
ao tentar activar o componente; o que poderá estar errado ??

select mat.tdia, mat.tmes, mat.tano, sum(mat.tnotto) as Matriz,
(select  sum(f03.tnotto) from estf03 f03
where (mat.tdia = f03.tdia) and (mat.tmes = f03.tmes) and (mat.tano =
f03.tano)
and (f03.topera = 2) and (f03.thisto = 'S')) as Brasilia,
(select  sum(f04.tnotto) from estf04 f04
where (mat.tdia = f04.tdia) and (mat.tmes = f04.tmes) and (mat.tano =
f04.tano)
and (f04.topera = 2) and (f04.thisto = 'S')) as Poa,
(select  sum(f05.tnotto) from estf05 f05
where (mat.tdia = f05.tdia) and (mat.tmes = f05.tmes) and (mat.tano =
f05.tano)
and (f05.topera = 2) and (f05.thisto = 'S')) as Belo,
(select  sum(f06.tnotto) from estf06 f06
where (mat.tdia = f06.tdia) and (mat.tmes = f06.tmes) and (mat.tano =
f06.tano)
and (f06.topera = 2) and (f06.thisto = 'S') and  (f06.tufc <> 'SP'))
as Curitiba,
(select  sum(f06.tnotto) from estf06 f06
where (mat.tdia = f06.tdia) and (mat.tmes = f06.tmes) and (mat.tano =
f06.tano)
and (f06.topera = 2) and (f06.thisto = 'S') and  (f06.tufc = 'SP'))
as CuritiSP,
(select  sum(f07.tnotto) from estf07 f07
where (mat.tdia = f07.tdia) and (mat.tmes = f07.tmes) and (mat.tano =
f07.tano)
and (f07.topera = 2) and (f07.thisto = 'S')) as SantaCata
     from estmat mat
where (mat.tmes = :pmes) and (mat.tano = :pano) and (mat.topera = 2)
and (mat.thisto = 'S')
group by mat.tdia, mat.tmes, mat.tano
order by mat.tdia

grato

Stainle
[-----x-----]

=================================
"Nunca ande pelo caminho traçado, pois ele conduz somente até onde os outros já foram."
Alexander Graham Bell
=================================
Welson de Avelar Soares Filho
Analista/Programador Delphi
Gemini Sistemas
<www.geminisistemas.com.br>
Juiz de Fora - Minas Gerais
=================================
           
---------------------------------
Yahoo! Search
Imposto de Renda 2006: o prazo está acabando. Faça já a sua declaração no site da Receita Federal.

[As partes desta mensagem que não continham texto foram removidas]



--
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>





        Yahoo! Grupos, um serviço oferecido por:            PUBLICIDADE
    var lrec_target="_top";var lrec_URL=new Array();  lrec_URL[1]="http://br.ard.yahoo.com/SIG=12fitahei/M=399886.8024024.9211419.2369893/D=brclubs/S=2137111264:HM/Y=BR/EXP=1145939848/A=3535733/R=0/id=flashurl/SIG=1547k1cau/*http://lt.dell.com/lt/lt.aspx?CID=12091&LID=330389&DGC=BA&DGSeg=DHS&DURL=http://www1.la.dell.com/content/products/category.aspx/desktops?c%3dbr%26l%3dpt%26s%3ddhs";  var lrec_flashfile="http://br.i1.yimg.com/br.yimg.com/i/br/ads7/240406_y300x250_abr11_dhs_dimension5150.swf?clickTAG=_javascript_:LRECopenWindow(1)";  var lrec_altURL="http://br.ard.yahoo.com/SIG=12fitahei/M=399886.8024024.9211419.2369893/D=brclubs/S=2137111264:HM/Y=BR/EXP=1145939848/A=3535733/R=1/id=altimg/SIG=1547k1cau/*http://lt.dell.com/lt/lt.aspx?CID=12091&LID=330389&DGC=BA&DGSeg=DHS&DURL=http://www1.la.dell.com/content/products/category.aspx/desktops?c%3dbr%26l%3dpt%26s%3ddhs";  var lrec_altimg="http://br.i1.yimg.com/br.yimg.com/i/br/ads7/240406_y300x250_abr11_dhs_dimension5150.gif";
var lrec_width=300;var lrec_height=250;     
 
---------------------------------
  Links do Yahoo! Grupos
   
   Para visitar o site do seu grupo na web, acesse:
http://br.groups.yahoo.com/group/delphi-br/
   
   Para sair deste grupo, envie um e-mail para:
[EMAIL PROTECTED]
   
   O uso que você faz do Yahoo! Grupos está sujeito aos Termos do Serviço do Yahoo!.



           
---------------------------------
Yahoo! Messenger com voz - Instale agora e faça ligações de graça.

[As partes desta mensagem que não continham texto foram removidas]



--
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

<*> Para ver as mensagens antigas, acesse:
    http://br.groups.yahoo.com/group/delphi-br/messages

<*> Para falar com o moderador, envie um e-mail para:
    [EMAIL PROTECTED]



Yahoo! Grupos, um serviço oferecido por:
PUBLICIDADE


Links do Yahoo! Grupos

Responder a