Search
 
SCRIPT & CODE EXAMPLE
 

SQL

CALCULATING MONTHS BETWEEN TWO DATES IN POSTGRESQL

EXTRACT(year FROM age(end_date,start_date))*12 + EXTRACT(month FROM age(end_date,start_date))
Comment

postgres get number of days between two dates

SELECT
  AGE('2012-03-05', '2010-04-01'),
  DATE_PART('year', AGE('2012-03-05', '2010-04-01')) AS years,
  DATE_PART('month', AGE('2012-03-05', '2010-04-01')) AS months,
  DATE_PART('day', AGE('2012-03-05', '2010-04-01')) AS days;
Comment

PREVIOUS NEXT
Code Example
Sql :: sqlite show table indexes 
Sql :: oracle pagination query rownum 
Sql :: mysql where not equal 
Sql :: postgres list databases 
Sql :: mysql ip address 
Sql :: mysql email validation 
Sql :: mysql terminal run sql file 
Sql :: postgresql check privileges on schema 
Sql :: mysql list tables by size 
Sql :: python postgresQL select table 
Sql :: mysql backup table 
Sql :: update table from another table 
Sql :: RowDataPacket 
Sql :: how to check grants on a package in oracle 
Sql :: install mysql on ubuntu 
Sql :: oracle to_char number format percentage 
Sql :: DATEDIFF minute postgres 
Sql :: multiple like in sql 
Sql :: change filed order in mysql 
Sql :: mysql export database command line 
Sql :: create database in mysql 
Sql :: import sql dump into postgresql database 
Sql :: mysql server not starting in xampp in mac 
Sql :: how to combine 2 tables in mysql 
Sql :: select * where id = 1,2,3 
Sql :: oracle index size calculation 
Sql :: sql formats 
Sql :: sql server drop database 
Sql :: user_dependencies 
Sql :: sequence postgresql 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =