Yes I did mean that...
Except none of these work as expected.
My string column is of type Text (without length), would this make a
difference?? I wouldn't have believed so.
Here's a little test case performed within commsql (which, btw,
should be marked a public class one, day...).
CREATE TABLE Names (i INTEGER, t TEXT)
INSERT INTO Names VALUES (0, Gueulu)
INSERT INTO Names VALUES (1, Grueulu)
INSERT INTO Names VALUES (2, Grulu)
SELECT * FROM Names
SELECT * FROM Names WHERE t LIKE "*eu*"
SELECT * FROM Names WHERE POSITION(Names.t, "eu") >0
which produces the following complete dump:
create table Names (i INTEGER, t TEXT)
java-thread-7 create table Names (i INTEGER, t TEXT)
Enter SQL string, or . to exit
INSERT INTO Names VALUES (0, Gueulu)
java-thread-7 INSERT INTO Names VALUES (0, Gueulu)
Enter SQL string, or . to exit
INSERT INTO Names VALUES (1, Grueulu)
java-thread-7 INSERT INTO Names VALUES (1, Grueulu)
Enter SQL string, or . to exit
INSERT INTO Names VALUES (2, Grulu)
java-thread-7 INSERT INTO Names VALUES (2, Grulu)
Enter SQL string, or . to exit
SELECT * FROM Names
java-thread-7 SELECT * FROM Names
3 rows returned
last row: 2,Grulu
first row: 0,Gueulu
full results:
i,t
Row 1: 0,Gueulu
Row 2: 1,Grueulu
Row 3: 2,Grulu
Enter SQL string, or . to exit
SELECT * FROM Names WHERE t LIKE "*eu*"
java-thread-7 SELECT * FROM Names WHERE t LIKE "*eu*"
0 rows returned
last row: java.sql.SQLException: Row number 0 is out of range
at jdbc.idbResultsSet.setCurRow(idbResultsSet.java:122)
at commsql.dispResultSet(Compiled Code)
at commsql.main(Compiled Code)
at org.jxe.tools.java.Java.main(Compiled Code)
at org.jxe.kernel.Tool$ToolThread.run(Tool.java:215)
Enter SQL string, or . to exit
Gee I'm feeling beginner...
Paul
>Paul,
>
>Do you mean something like this?
>
>SELECT * FROM mytable WHERE mytable.column LIKE "*searchstring*";
>
>or using the position function...
>
>SELECT * FROM mytable WHERE POSITION(mytable.column, "searchstring") > 0;
>
>Phillip B.
>
>-----Original Message-----
>From: Paul Libbrecht <paul@ags.uni-sb.de>
>
>
>>Hi all,
>>
>>Sorry for this fairly off-topic question... I couldn't figure out how
>>to remember or get a pointer to a select query that would select all
>>rows where a column contained a string (a like-it string).
>>
>>If anyone has two minutes and a pointer... that would be appreciated.
>>
>>Thanks.
>>
> >Paul
>
-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.
|