lower and upper limit problem

Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Aug 2007
Posts: 33
Reputation: ansari.wajid is an unknown quantity at this point 
Solved Threads: 0
ansari.wajid ansari.wajid is offline Offline
Light Poster

lower and upper limit problem

 
0
  #1
Jul 28th, 2008
I have a table with 3 columns as follows:

lower upper id
12 20 100
100 150 200


I want to select range of numbers based on lower and upper column.
For example I want to display numbers between 12 to 20 or from 100 to 150.
How to do it. thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 22
Reputation: RipperJT is an unknown quantity at this point 
Solved Threads: 3
RipperJT RipperJT is offline Offline
Newbie Poster

Re: lower and upper limit problem

 
0
  #2
Jul 29th, 2008
Hi, you can use math comparison operators to select from a range of values, you can add an OR to the statement below to select from an additional range.
  1. SELECT
  2. *
  3. FROM
  4. TableName
  5. WHERE
  6. ([lower] >= 12
  7. AND
  8. [upper] <= 20)
  9. OR
  10. ([lower] >= 100
  11. AND
  12. [upper] <= 150)
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 33
Reputation: ansari.wajid is an unknown quantity at this point 
Solved Threads: 0
ansari.wajid ansari.wajid is offline Offline
Light Poster

Re: lower and upper limit problem

 
0
  #3
Jul 30th, 2008
Thanks buddy
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC