List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 30 1999 2:12am
Subject:Re: substring mysql
View as plain text  
At 9:58 AM -0500 9/29/99, Thomas ViÈ wrote:
>Hi all,
>
>
>No subqueries in Mysql ? So how can I do it :
>I need to select from a table, all the records where a field equals a
>string coming from any record of another Table. I.e. in a normal SQL
>query would be :
>
>SELECT field1 FROM table1 WHERE field1 IN (SELECT field2 FROM table2)
>(I'm not sure about this one)

SELECT table1.field1
FROM table1, table2
WHERE table1.field1 = table2.field2

>
>2nd question : what if I want to check if field2 in this example is a
>substring of field1 ?

SELECT table1.field1
FROM table1, table2
WHERE INSTR(table1.field1,table2.field2)

>
>I'm in trouble, checked all docs, if you're in the mood, thanks for
>helping.
>
>Thomas - tvie@stripped
>
>"I created you and your universe, you can't see nor understand my
>existence,
>but I am with each one of you every moment of your life
>and you're conscious of that ! Who am I ?
>God ?
>Nope... time."
>--anonymous.
>
>
>
>
>---------------------------------------------------------------------
>Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
>posting. To request this thread, e-mail mysql-thread14696@stripped
>
>To unsubscribe, send a message to the address shown in the
>List-Unsubscribe header of this message. If you cannot see it,
>e-mail mysql-unsubscribe@stripped instead.


--
Paul DuBois, paul@stripped
Thread
substring mysqltvie29 Sep
  • Re: substring mysqlPaul DuBois30 Sep
    • Re: substring mysqlPhilips30 Sep
      • Re: substring mysqlMartin Ramsch30 Sep