Solved

Select records based on time

Posted on 2009-04-09
1
151 Views
Last Modified: 2012-05-06
I need to be able to do a select statement for all records that are made where they have been updated within 45 minutes prior to a input time.

Example
declare dt datetime
set dt =  2009-04-08 10:58
select memberID, LastName where lastLogin > 45 minutes prior to dt and lastLogin <=  dt
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 24108045
declare @dt datetime
set @dt =  '2009-04-08 10:58'
select memberID, LastName
where lastLogin > dateadd(n, -45, @dt) and
lastLogin <=  @dt
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question