Chris,

You're almost there!
select * from temp where col2 like concat('%',col1, '%');

Andy

> -----Original Message-----
> From: Chris A. Mattingly [mailto:[EMAIL PROTECTED]
> Sent: 07 November 2003 17:01
> To: [EMAIL PROTECTED]
> Subject: MySQL query question
>
>
> I've searched around on the lists archives and even did some
> googling, but I'm
> having trouble finding the answer to this question.
>
> Given that I have a table with 2 columns (say col1, col2) I want
> to be able to
> search for the value of col1 in the value of col2.  Let's say that in one
> instance col1 = "foo" and col2 = "foobar", I want to know, but if col1
> = "temp" and col2 = "foobar", I do not want anything returned.
>
> A query something like:  SELECT col2 FROM table WHERE col2 LIKE '%col1%';
>
> Any help would be greatly appreciated.
>
> -Chris
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to