Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL BETWEEN Question
Message
De
17/01/2002 11:31:36
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
SQL BETWEEN Question
Divers
Thread ID:
00606143
Message ID:
00606143
Vues:
52
I have a range of values in a table that use character data. The value that I am querying is also a character data type (C). When I run the below query I get two rows returned when using BETWEEN with a character data type but only one when using a numeric data type. Seems odd that I can not use character values for this query:
SET ANSI ON

SELECT * FROM tbl WHERE '102108' BETWEEN pin_beg AND pin_end

Pkx  Pin_beg	 Pin_end  
 2   10000  	 11999    
17   100000 	 199999 


SELECT * from tbl WHERE VAL('102108') between VAL(pin_beg) AND VAL(pin_end)

Pkx  Pin_beg	 Pin_end  
17   100000 	 199999 
The 2nd SQL statement works correctly but I am not sure why the first one returned two rows. Anyone know why?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform