Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tricky Attempt
Message
From
21/03/2003 08:52:31
 
 
To
20/03/2003 17:38:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00768370
Message ID:
00768526
Views:
20
>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 
Previous
Reply
Map
View

Click here to load this message in the networking platform