Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql get number of days between two dates

DATEDIFF(DAY, '1/1/2011', '3/1/2011')
Comment

count weekend days between two dates sql

DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '2022/06/01'
SET @EndDate = '2022/06/30'


SELECT
  (DATEDIFF(wk, @StartDate, @EndDate) * 2)
   +(CASE WHEN DATENAME(dw, @StartDate) = 'Sunday'   THEN 1 ELSE 0 END)
   +(CASE WHEN DATENAME(dw, @EndDate)   = 'Saturday' THEN 1 ELSE 0 END)
Comment

PREVIOUS NEXT
Code Example
Sql :: date less than in sql 
Sql :: docker hub mysql 
Sql :: how to put is null in where in clause 
Sql :: python connect microsoft sql server 
Sql :: T sql less than date 
Sql :: timestamp sql 
Sql :: mysql select inside sum 
Sql :: mysql replace regex 
Sql :: else if sql 
Sql :: mysql count 
Sql :: minus equivalent in my sql 
Sql :: select count distinct multiple columns sql server 
Sql :: SQL/update 
Sql :: set engine to innodb 
Sql :: Rows, INSERT INTO, Returning 
Sql :: get from database the most recent data limit by 5 
Sql :: mysql get 2nd value in comma separated list 
Sql :: windows aggregate functions in postgresql 
Sql :: sql order 
Sql :: sqlalchemy query sql compiled 
Sql :: check if user defined table type exists in sql server 
Sql :: postgresql array to rows 
Sql :: insert into table using openquery 
Sql :: sql where multiple values 
Sql :: order by in codeigniter query builder 
Sql :: attributes of cursor in sql 
Sql :: creashed table mysql 
Sql :: timestamp(0) postgresql 
Sql :: mysql multiply 
Sql :: mysql privileges 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =