Simply subtract them:
SELECT ('2015-01-12'::date - '2015-01-01'::date) AS days;
The result:
days
------
11
More Related Contents:
- Get a list of dates between two dates using a function
- Get first day of week in SQL Server
- How do I exclude Weekend days in a SQL Server query?
- Get dates from a week number in T-SQL
- Date conversion and culture: Difference between DATE and DATETIME
- SQL Query to find the last day of the month
- How to: Create trigger for auto update modified date with SQL Server 2008
- Comparing dates stored as varchar
- How to migrate a PostgreSQL database into a SQLServer one?
- What is the PostgreSQL equivalent for ISNULL()
- migrate data from MS SQL to PostgreSQL?
- How do I generate a random number for each row in a T-SQL select?
- Combine multiple results in a subquery into a single comma-separated value
- Infinite loop CTE with OPTION (maxrecursion 0)
- Floor a date in SQL server
- LEN function not including trailing spaces in SQL Server
- How FOR XML PATH(”) works when concatenating rows
- SQL Server ORDER BY date and nulls last
- SSRS 2014 report deploy issue
- Best way to implement an audit trail in SQL Server?
- Set start value for column with autoincrement
- SqlDataAdapter.Fill method slow
- What is the Oracle equivalent of SQL Server’s IsNull() function?
- How to determine the field value which can not convert to (decimal, float,int) in SQL Server
- Making an Entity Framework Model span multiple databases
- SQL Server 2008 Row Insert and Update timestamps
- how to cast the hexadecimal to varchar(datetime)?
- Generate table relationship diagram from existing schema (SQL Server) [closed]
- Error converting data types when importing from Excel to SQL Server 2008
- CHECKSUM and CHECKSUM_AGG: What’s the algorithm?