Solved

BETWEEN

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

20 Experts available now in Live!

Get 1:1 Help Now