Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgresql get difference between two dates

select age('2010-04-01', '2012-03-05'),
       date_part('year',age('2010-04-01', '2012-03-05')),
       date_part('month',age('2010-04-01', '2012-03-05')),
       date_part('day',age('2010-04-01', '2012-03-05'));
Comment

Postgresql get diff between two dates in Months

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

PREVIOUS NEXT
Code Example
Sql :: sql pagination 
Sql :: extract weekday from date in sql 
Sql :: database dump mysql command 
Sql :: postgres show databases 
Sql :: mysql search table in all databases 
Sql :: check postgresql version in rails console 
Sql :: mysql count number of occurrences in a column 
Sql :: import all databases mysql 
Sql :: kill a pid redshift 
Sql :: SQL DEFAULT Constraint With Alter Table 
Sql :: mysql copy table to another table 
Sql :: update with select postgresql 
Sql :: mysql delete duplicate rows but keep one 
Sql :: select list is not in group by clause and contains nonaggregated column codeigniter 
Sql :: SQL NOT BETWEEN Operator 
Sql :: oracle percentage 
Sql :: sqlite save db 
Sql :: sql count null values in all columns 
Sql :: get time component of datetime sql 
Sql :: 3rd highest value in sql 
Sql :: mysql backup database command line 
Sql :: import sql in postgresql 
Sql :: between sql server 
Sql :: distinct sql 
Sql :: postgres update with if condition query 
Sql :: oracle index size 
Sql :: alternative for LIMIT sql 
Sql :: update sqlite 
Sql :: oracle object dependencies 
Sql :: postgres integer to serial 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =