Re: [SQL] trying to pattern match to a value contained in a column

2000-12-09 Thread Bruce Momjian
> Beth Gatewood <[EMAIL PROTECTED]> writes: > > I hope this isn't because I am using 6.3 (yes...I know it is very very > > old but this is currently where the data is!) > > > here is the query: > > select * from av34s1 where chromat ~~ ('%' || sample || '%'); > > ERROR: parser: syntax error at o

Re: [SQL] trying to pattern match to a value contained in a column

2000-12-07 Thread Ross J. Reedstrom
Beth - Both errors you describe are due to using 6.3. The first one might work if you parenthize the repeated use of ||, as so: select * from av34s1 where chromat ~~ (('%' || sample ) || '%'); Ross On Thu, Dec 07, 2000 at 01:45:00PM -0800, Beth Gatewood wrote: > Hi Francis- > > Thank you for

Re: [SQL] trying to pattern match to a value contained in a column

2000-12-07 Thread Tom Lane
Beth Gatewood <[EMAIL PROTECTED]> writes: > I hope this isn't because I am using 6.3 (yes...I know it is very very > old but this is currently where the data is!) > here is the query: > select * from av34s1 where chromat ~~ ('%' || sample || '%'); > ERROR: parser: syntax error at or near "||" I

Re: [SQL] trying to pattern match to a value contained in a column

2000-12-07 Thread Joel Burton
> This makes perfect sense...unfortunately it isn't working... > > I hope this isn't because I am using 6.3 (yes...I know it is very very > old but this is currently where the data is!) > > here is the query: > > select * from av34s1 where chromat ~~ ('%' || sample || '%'); > > > ERROR: pars

Re: [SQL] trying to pattern match to a value contained in a column

2000-12-07 Thread Peter Eisentraut
Beth Gatewood writes: > So-If I had a table where I had LONG_NAME and ABBR as attributes. > > I want something like > > SELECT whatever FROM my_table WHERE long_name LIKE '%[the value of ABBR > in that row]%'; SELECT whatever FROM my_table a, my_table b WHERE a.long_name like (b.abbr || '%'); -

Re: [SQL] trying to pattern match to a value contained in a column

2000-12-07 Thread Beth Gatewood
Hi Francis- Thank you for your rapid and excellent response. This makes perfect sense...unfortunately it isn't working... I hope this isn't because I am using 6.3 (yes...I know it is very very old but this is currently where the data is!) here is the query: select * from av34s1 where chromat

RE: [SQL] trying to pattern match to a value contained in a column

2000-12-07 Thread Francis Solomon
Hi Beth, Try something like this ... Here's a simple table schema: CREATE TABLE abbrev ( abbr varchar(10), long_name varchar(50), primary key(abbr) ); Throw in some random data: INSERT INTO abbrev VALUES ('fs', 'fsolomon'); INSERT INTO abbrev VALUES ('bg', 'bgatewood'); INSERT INTO abbr