Solved

BETWEEN

Posted on 2011-09-14
3
323 Views
Last Modified: 2012-06-22
I would like to select all rows that have Id between 50 and 60, but I would not like to select the number 50 and the number 60. By using BETWEEN one selects both. How is best to do this?
0
Comment
Question by:johnkainn
[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 5

Accepted Solution

by:
zvytas earned 125 total points
ID: 36536130
SELECT *
FROM Table
WHERE ID > 50 AND ID < 60

OR

SELECT *
FROM Table
WHERE ID BETWEEN 51 AND 59
0
 
LVL 12

Expert Comment

by:viralypatel
ID: 36536185
0
 
LVL 56

Expert Comment

by:HainKurt
ID: 36536394
:) maybe this:


SELECT *
FROM Table
WHERE ID BETWEEN 50 AND 60 and id != 50 and id != 60
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

628 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