Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Query

Posted on 2013-01-18
4
Medium Priority
?
225 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:Josh Hind
  • 2
4 Comments
 
LVL 44

Assisted Solution

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

Author Comment

by:Josh Hind
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 800 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:Josh Hind
ID: 38793547
THANK YOU!!
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

972 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