From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Jon Griffin <jon(at)jongriffin(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: plpgsql question |
Date: | 2010-08-28 03:25:09 |
Message-ID: | AANLkTinwfW9JuwFYHS8jiy0V7QAGvUqVBuaxTLktuQo5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
you used a wrong syntax
Regards
Pavel Stehule
2010/8/28 Jon Griffin <jon(at)jongriffin(dot)com>:
> I am trying to calculate a value from a current record in a query and can't
> seem to get it working.
>
> Here is the shortened query;
> SELECT
> s.id,
> r.the_date_time,
> s.open_price,
> s.high_price,
> s.low_price,
> s.close_price,
> thesheet_onepair.symbol,
> r.buy_long,
> r.buy_stop,
> r.sell_cl,
> r.stop_sell,
> r.sell_short,
> r.sell_stop,
> r.buy_os,
> r.stop_buy,
> check_long_profit ()as tst
> FROM
> public.thesheet_dailystats s,
> public.thesheet_recommendation r,
> public.thesheet_onepair
> WHERE
> s.one_pair_id = thesheet_onepair.id AND
> s.the_date = r.the_date_time::date AND
> r.one_pair_id = thesheet_onepair.id
> ORDER BY
> r.the_date_time DESC,
> thesheet_onepair.id ASC;
>
>
> check_long_profit is the function. I basically want to do some calculations
> on this record and return some calculated fields.
>
> I can't seem to figure out how to pass the row.
>
> Here is my header for the function
> create or replace function check_long_profit () returns integer AS $$
>
> I know I am missing something easy.
>
> Thanks
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2010-08-28 07:51:23 | Re: WAL Archive Log |
Previous Message | Jon Griffin | 2010-08-28 01:48:40 | plpgsql question |