Solved

sql server - select a value between to specific dates

Posted on 2013-01-21
2
304 Views
Last Modified: 2013-01-21
Hi

Im wanting to do a select query that selects a value from a table where its created date is in the range of 2 specific dates (date from & date to)

Thanks
0
Comment
Question by:razza_b
2 Comments
 
LVL 8

Accepted Solution

by:
virtuadept earned 500 total points
ID: 38801399
SELECT col_with_value
FROM the_table
WHERE col_create_date >= '1/1/2013'
AND col_create_date <= '2/1/2013'

you could use @variables instead of hard coded dates. Depends on what you are calling this from. Also post the table def and we can be more helpful.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 38801650
you can also use BETWEEN

SELECT col_with_value
FROM the_table
WHERE col_create_date BETWEEN '1/1/2013' AND '2/1/2013'
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.

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

860 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