Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tricky Attempt
Message
De
21/03/2003 08:52:31
 
 
À
20/03/2003 17:38:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00768370
Message ID:
00768526
Vues:
19
>I have a column in the table that looks like this
>
>Items
>-----
>1:2:4:7:9:12:
>3:4:6:8:10:11:13:
>2:4:8:9:12:14:
>6:9:13:17:22:
>
>I want to select all rows where Items contain 2: or 8:. I started with
select * from parts where atc(":2:",":"+parts.Items)>0 ;
OR atc(":8:",":"+parts.Items)>0

Adding ":" to the front of the Items column allows you to search for :2: without having a special case for when 2: are the first two characters.
Then the OR clause is easy.
create cursor test (items c(20))

INSERT INTO test VALUES ("1:2:4:7:9:12:")
INSERT INTO test VALUES ("3:4:6:8:10:11:13:")
INSERT INTO test VALUES ("2:4:8:9:12:14:")
INSERT INTO test VALUES ("6:9:13:17:22:")

SELECT RECNO() which,* ;
FROM test WHERE ATC(":2:",":"+items) >0

SELECT RECNO() which,* ;
FROM test WHERE ATC(":2:",":"+items) >0 ;
OR ATC(":8:",":"+items) >0 
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform