Solved

SQL Query

Posted on 2013-01-18
4
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 43

Assisted Solution

by:zephyr_hex (Megan)
zephyr_hex (Megan) 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
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 antispam), the admini…

739 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