Solved

Select records based on time

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

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 …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

747 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

15 Experts available now in Live!

Get 1:1 Help Now