Subject Re: extract(month from tablename.sendate)
Author dirinler
Thank you for you interese anderson but if i use 'extract(month from
sevkdetail.sevktarihi)as sevk_ayi ' this is ok

but when i use this code with week it says this error

project project2.exe raised exception class EIBInterBaseError with
message 'Dynamic SQL Error SQL error code=-104 token unknown-line
2,column 9 week'.

:((

--- In firebird-support@yahoogroups.com, "Anderson Farias"
<peixedragao@...> wrote:
>
> > As far as I can see, I *think* your problem is using a function
at your
> > group by clause, try this instead:
>
> Hummmm... not really... I've tested here under 2.1 and there's no
problem at
> all. So, forget it.
>
>
> First try the SQL direct on some Tool like flamerobin, if it works
than the
> problem must be when you add strings to your Query.SQL
>
> try this:
>
> with IBQuery2 do
> begin
> Close;
> SQL.Clear;
> SQL.Add( 'select sum(sevkdetail.sevkadeti) as top_sevki, ');
> SQL.Add( 'extract(week from sevkdetail.sevktarihi)as sevk_ayi ');
> SQL.Add( 'from sevkdetail ');
> SQL.Add( format('where sevktarihi>=%s', [QuoteStr(datetostr
> (DateTimePicker1.date))]) );
> SQL.Add( format('AND sevkdetail.sevktarihi<=%s', [QuoteStr
(datetostr
> (DateTimePicker2.date))]) );
> SQL.Add( 'GROUP BY extract(week from sevkdetail.sevktarihi)' );
> open;
> end;
>
>
> HTH
>
> Regards,
> Anderson Farias
>