Solved

SQL Between using multiple rows from 2 colums (start and end)

Posted on 2014-03-10
3
39 Views
Last Modified: 2016-05-29
I'm trying to pull data from a table and my where clause contains needs to contain a BETWEEN condition.  Basically a Start code and an End code.  Each Item that I'm pulling data can contain any number of lines in this table from 1 to over 600 lines.  So, I need to be able to query the table when the user enters a code to look to see if it falls into a range that has been established (start and end).  Each range varies in size.  

Is there a way to check 600 lines to see if the code that was entered by the user falls into any of the ranges?  I would like to avoid FETCH sql, because some of the code I still need to use in Access!  But I'll take any help at this point too!!!!  Thanks.
0
Comment
Question by:sborchers
[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
3 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39919182
Could you do something like this:

SELECT * FROM YourTAble WHERE Col1 > YourFirstValue AND Col2< YourSecondValue

If not, could you provide more information about your tables, and show some sample data, along with some desired results?
0
 

Author Comment

by:sborchers
ID: 39919329
I will give it a shot in the morning and if it doesn't work I'll try to provide more details.  Thanks, Mike
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

740 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