Solved

BETWEEN

Posted on 2011-09-14
3
312 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
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 51

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 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