Solved

SQL Query

Posted on 2013-01-18
4
223 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

636 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