About 84,600 results
Open links in new tab
  1. Subtract two dates in Microsoft SQL Server - Stack Overflow

    Feb 3, 2015 · Current date Last used date '2016-03-30' '2015-02-03' Current date refers to today's date, "Last used date" is a measure. How to write a query in SQL Server? I have this but doesn't work (it …

  2. Performing date/time subtraction in SQL Server - Stack Overflow

    Mar 15, 2012 · I have four columns in a table: date entered, time entered, date completed, time completed I would like to know the difference between date/time ENTERED and date/time …

  3. Subtract two dates in SQL and get days of the result

    May 25, 2015 · Subtract two dates in SQL and get days of the result Asked 12 years, 11 months ago Modified 4 years, 10 months ago Viewed 206k times

  4. sql - Subtract one day from datetime - Stack Overflow

    Mar 13, 2013 · SELECT PatientID, count(1) AS Total_Count FROM EmergencyDepart_Data ED_Data WHERE ED_Data.[Arrival Date] = getdate() - 1 GROUP BY PatientID Where as the below query …

  5. How to subtract 30 days from the current date using SQL Server

    99 I am unable subtract 30 days from the current date and I am a newbie to SQL Server. This is the data in my column

  6. sql - How do I subtract two datetime values? - Stack Overflow

    Aug 14, 2019 · I have a table with two columns login and logout. If a row has values "2019-08-07 20:37:12" in login column and "2019-08-07 21:14:16" in logout column, I want the difference between …

  7. SQL Query Where Date = Today Minus 7 Days - Stack Overflow

    SQL Query Where Date = Today Minus 7 Days Asked 8 years, 9 months ago Modified 1 year, 1 month ago Viewed 226k times

  8. Is there a way to subtract an amount of days from a date in SQL?

    Apr 9, 2010 · I know about DATEDIFF(d, date1, date2), but I am not looking to subtract two dates, rather an amount of days from a date. For example: "2010-04-13" - 4 = "2010-04-09" Is that possible with …

  9. php - How to subtract two sql datetime fields - Stack Overflow

    Apr 23, 2015 · 3 I have two datetime values on sql database and I want to subtract them and get the difference as a number of hours. So far I have created three values. Deptime and ArrTime as …

  10. SQL convert datetime and subtract hours - Stack Overflow

    Oct 6, 2012 · The query above that uses dateadd will always subtract 4 hours. If your goal is to convert an arbitrary datetime from UTC to local time, then it's more complicated because the offset that you …