Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Raw into column

CREATE or replace FUNCTION budget_function(num integer)
RETURNS TABLE(budget bigint, dub_date text)
LANGUAGE plpgsql
AS $function$
begin

    return query
        SELECT SUM(t1.budget) budget,
               string_agg(TO_CHAR("bud_date",'YYYY-MM-DD'),'-') date
        FROM (
          SELECT *, ROW_NUMBER() OVER(ORDER BY "bud_date") rn
          FROM budget_table
        ) t1
        GROUP BY (rn - 1)/num
        ORDER BY (rn - 1)/num;
    
end
$function$
;
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle create chain rule 
Sql :: PROSYS SQL 
Sql :: mysql c commands 
Sql :: mysql phpmyadmin mysqli_construct:: error for mac user 
Sql :: raise notice concat string postgresql 
Sql :: Split Column with delimiter into multiple columns 
Sql :: mysql error 1215 
Sql :: Update Query in SQL Server Table - NAYCode.com 
Sql :: sql orcale i forgot what my name & password was 
Sql :: Create a username nd password in MySql 
Sql :: how to make full text search dynamic in mysql 
Sql :: mysql default tls v1.3 ciphersuites 
Sql :: sqlite mode default 
Sql :: how to escape single quotes in SQL 
Sql :: sql script to get a type task on jira datbase for 12 months 
Sql :: oracle grant create job 
Sql :: configurasi database whmcs 
Sql :: Which MySQL statement is used to delete data from a database 
Sql :: SQL Multiple Parameterized Procedures 
Sql :: select all fields from table 
Sql :: mysql-split-and-join-the-values 
Sql :: oracle table change tablespace lob column 
Sql :: Mysql get routine parameter list 
Sql :: How is the default tablespace determined when creating a table? 
Sql :: ACCEPT nome PROMPT on oracle 
Sql :: reset increment sqk 
Sql :: in sql developer where equal queres 
Sql :: sql datediff db2 
Sql :: how to install sql server 
Sql :: How to display top 50 rows? 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =