Solved

SQL Query

Posted on 2013-01-18
4
217 Views
Last Modified: 2013-01-18
I’m writing this query and i can’t seem to pull one month’s worth of data.  

SELECT intr_loc, intr_idcode, intr_item, intr_date, intr_issued, intr_unit_price, intr_req_no, intr_po_no, intr_whmd_wo_num, intr_wo_task, intr_trno, intr_trtype, intr_trcode, intr_convert
FROM intrhist

I’ve tried a TON of syntaxes in ‘WHERE’ but i can’t get it to return one month’s worth of data.  I can get it to return ONE YEAR’s worth but that’s kind of difficult to work with.  

WHERE intr_date = '2012-10-10' or '2012-10-01'
WHERE intr_date >= 2012-12-01 OR intr_date <= 2012-12-31
WHERE intr_date LIKE '[2012-06]%'
WHERE intr_date LIKE ‘2012-10________________’

The date field is formatted like this:  2012-05-11 00:00:00.000


How can i do that?
0
Comment
Question by:MRGCD-IS
  • 2
4 Comments
 
LVL 42

Assisted Solution

by:zephyr_hex
zephyr_hex earned 200 total points
ID: 38793507
try this:
WHERE intr_date >= 2012-12-01 AND intr_date <= 2012-12-31
0
 

Author Comment

by:MRGCD-IS
ID: 38793512
That doesn't return any data.  It compiles but after it executes the results are empty.
0
 
LVL 15

Accepted Solution

by:
tim_cs earned 200 total points
ID: 38793530
Make sure to put single quotes around the dates and try zephyr_hex's example again.

WHERE intr_date >= '2012-12-01' AND intr_date <= '2012-12-31'
0
 

Author Comment

by:MRGCD-IS
ID: 38793547
THANK YOU!!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

13 Experts available now in Live!

Get 1:1 Help Now