我有一个临时表function(postgresql)
create temporary table temp_table (
id serial
,breakup_id integer
,enquiry_id integer
,estimate_id integer
,customer_name CHARACTER VARYING
,month integer
,year integer
,amount numeric
) on commit drop;
Run Code Online (Sandbox Code Playgroud)
我需要for loop这个临时表来amount使用 更新列breakup_id。如何做到这一点postgresql function?
如何crosstab在postgresql. 请参考postgresql中的以下功能
create function sp_nextfollowup_count_byweek(_from timestamp without time zone,_to timestamp without time zone)
returns table(userid integer,username character varying,day1 bigint,day2 bigint,day3 bigint,day4 bigint,day5 bigint,day6 bigint,day7 bigint)as
$BODY$
BEGIN
return query
with cte as(
select * from crosstab($$
select follow_up_by,next_follow_up_date,count(*) from sales_enquiry_follow_up where next_follow_up_date between _from and _to
group by follow_up_by,next_follow_up_date
order by follow_up_by,next_follow_up_date$$,$$select date::timestamp without time zone
from generate_series(
_from,
_to,
'1 day'::interval
) date$$)
as(id integer, dd bigint,dd1 bigint,dd2 bigint,dd3 bigint,dd4 bigint,dd5 bigint,dd6 bigint)
)
select …Run Code Online (Sandbox Code Playgroud) 我有一些像这样的 HTML 内容
<p><b style="margin: 0px; padding: 0px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; font-family: Lato, Arial, Helvetica,
sans-serif; vertical-align: baseline; color: rgb(89, 89, 89);">'60 Degrees South Bar and Grill'</b><span style="color: rgb(89, 89, 89); font-family: Lato, Arial, Helvetica, sans-serif;">
is an imaginative and quirky space that allows diners to enjoy the sea breeze and spectacular views of the Indian Ocean from three terraces. The bar and Grill is ideally situated in </span>
<b style="margin: 0px; padding: 0px; …Run Code Online (Sandbox Code Playgroud)