Search
 
SCRIPT & CODE EXAMPLE
 

SQL

date diff sql

SELECT DATEDIFF(year, '2017/08/25', '2011/08/25') AS DateDiff;
Comment

sql date diff

SELECT DATEDIFF('2022-04-08',Date('2022-04-06 20:23:08')) as days,
TO_DAYS('2022-04-08') - TO_DAYS(date('2022-04-06 20:23:08')) as todays

//hours
SELECT TIMESTAMPDIFF(HOUR,NOW(),'2013-05-15 10:23:23')
   calculates difference in hour.(for days--> you have to define day replacing hour
Comment

PREVIOUS NEXT
Code Example
Sql :: random name function in mysql for nvarchar 
Sql :: postgres default user 
Sql :: rename constraint postgresql 
Sql :: Add SuperUser MySQL 
Sql :: 2nd highest salary in mysql 
Sql :: get value from a table an insert it with other values in another table sql 
Sql :: select and condition in sql 
Sql :: mysql set id auto increment 
Sql :: mysql extract month from date 
Sql :: sql limit results returned 
Sql :: how to print mysql query of codeigniter query builder 
Sql :: sql server update to null 
Sql :: date between in mysql 
Sql :: oracle insert or update 
Sql :: mysql database create 
Sql :: mysql separator 
Sql :: t-sql merge example 
Sql :: select if then postgresql 
Sql :: select sequence oracle 
Sql :: script sql backup database sql server 
Sql :: store select query result in variable sql server 
Sql :: sql count 
Sql :: mysql datetime to date 
Sql :: group_concat in mysql 
Sql :: referential integrity constraint 
Sql :: find the median in sql 
Sql :: postgres select as csv 
Sql :: sql drop procedure 
Sql :: incompatible sql_mode=only_full_group_by 
Sql :: sql convert datetime to year 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =