“PostgreSQL Antara Bulan” Kode Jawaban

PostgreSQL Antara Bulan

CREATE OR REPLACE FUNCTION public.fn_getlastofmonth (
  date
)
RETURNS date AS
$body$
begin
    return (to_char(($1 + interval '1 month'),'YYYY-MM') || '-01')::date - 1;
end;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;
--------------------------------------------------------------------------------
WHERE date >= '2012-01-01' 
  AND date < fn_getlastofmonth('2013-04-01') 
Obedient Osprey

PostgreSQL Antara Bulan

WHERE date >= DATE '2012-01-01' 
  AND date < DATE ('2013-04-01' + INTERVAL '1 MONTH')
Obedient Osprey

PostgreSQL Antara Bulan

CREATE OR REPLACE FUNCTION public.fn_getlastofmonth (
  date
)
RETURNS date AS
$body$
begin
    return (to_char(($1 + interval '1 month'),'YYYY-MM') || '-01')::date - 1;
end;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;
Obedient Osprey

PostgreSQL Antara Bulan

WHERE date >= DATE '2012-01-01' 
  AND date < DATE '2013-05-01'      --- first date of the next month
Obedient Osprey

Jawaban yang mirip dengan “PostgreSQL Antara Bulan”

Pertanyaan yang mirip dengan “PostgreSQL Antara Bulan”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya