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 :: mysql best varchar length size 
Sql :: oracle stop 
Sql :: v$session not found in oracle 
Sql :: différence entre deux dates sql oracle 
Sql :: oracle search columns in schema 
Sql :: woocommerce mysql price table 
Sql :: row number mysql 
Sql :: psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user 
Sql :: mysql update inner 
Sql :: SQL query to convert DD/MM/YYYY to YYYY-MM-DD 
Sql :: go install mysql 
Sql :: sql query to find duplicate email address 
Sql :: oracle add column with default value 
Sql :: mysql query unique column 
Sql :: show all public tables sql 
Sql :: oracle grants 
Sql :: update query formula in excel 
Sql :: select all field names for a table mysql 
Sql :: get date from timestamp in mysql 
Sql :: sql rename column 
Sql :: oracle limit rows 
Sql :: cast to float with .2 sql 
Sql :: epoch time converter in snowflake 
Sql :: how to add unique key constraint in mysql 
Sql :: postgres database sizes 
Sql :: media sql 
Sql :: check mysql username and password ubuntu 
Sql :: psql while loop 
Sql :: sqlalchemy left join 
Sql :: duplicate table sql 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =