Solved

Select records based on time

Posted on 2009-04-09
1
147 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now