Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 30th, 2008, 10:39 AM
Authorized User
 
Join Date: Oct 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default What is the statement to select limited values?

How to select the some of numbers in same column
if I have in column B these values :500-200-50-60-100
and I use this statement
Select A,B,C,D FROM TABLE1 Where B between '300' and '55 '
the result is: 500-50
and if I use this statement:
Select A,B,C,D from Table1 where B>=55 and B<=300
the result is: 500-50
and as I know the result must be like this:200-100-60.
How to do this/



 
Old December 1st, 2008, 02:42 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Do you mean that ONE RECORD of your table has the value
    '500-200-50-60=100'
????

Or do you mean that column B has FIVE DIFFERENT VALUES:
    500
    200
    50
    60
    100
????

And what is the DATA TYPE of your column B???

Your first SELECT there makes it appear that it is a TEXT field.

And if you mean you are getting INDIVIDUAL results of
    '500'
    '50'
then that's the right answer for a text field used with that query.

But I don't understand how your second query is working, at all, if column B is indeed a text field. And clearly the results make no sense at all if it's a numeric field.

You need to tell us:
(A) What KIND of database is this? (Access, SQL Server, etc.) [It only makes a difference because it tells us what default conversions would be made.]
(B) What is the DATA TYPE of your column B???





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select statement.. help please sarah lee SQL Server 2000 4 May 16th, 2007 09:13 AM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
Select Statement jmss66 VB How-To 3 March 13th, 2006 03:55 PM
Select Into statement ashu_from_india Oracle 8 October 9th, 2005 11:30 PM
SQL statement limited to 255 chars Mikeopolo Excel VBA 1 February 18th, 2005 09:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.