Solved

BETWEEN

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In this article I will describe the Detach & Attach 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.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now