From: Ananda Kumar Date: August 21 2009 6:55am Subject: Re: alternate in mysql List-Archive: http://lists.mysql.com/mysql/218450 Message-Id: <829b199c0908202355g566b898ao8b2e96bc8f9047b0@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cd6b33682d0430471a1596a --000e0cd6b33682d0430471a1596a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Johnny, Thanks for the reply, but the below sql does not seems to work SELECT * FROM tmp WHERE t REGEXP '^/sr/db/.*'; Empty set (0.02 sec) mysql> SELECT * FROM tmp WHERE t REGEXP '/sr/db/.*'; +----------------------------------------------------+ | t | +----------------------------------------------------+ | asdf /sr/db/ora/ora.ora /sr/db/ora/aaa.ora asdlkjf | On Thu, Aug 20, 2009 at 8:19 PM, Johnny Withers wrote: > You could try: > > SELECT * FROM tmp WHERE t REGEXP '^/sr/db/.*'; > > On Thu, Aug 20, 2009 at 9:15 AM, Ananda Kumar wrote: > >> Hi All, >> I have this data in both oracle and mysql. >> >> select * from tmp; >> T >> -------------------------------------------------- >> asdf >> /sr/db/ora/ora.ora >> asdfljk >> asdlkjf >> >> asdf >> /sr/db/ora/ora.ora >> /sr/db/ora/aaa.ora >> asdlkjf >> Where t is a varchar column, with each row having multiple lines. >> I can write this query in oracle to fetch only rows starting with ''sr/db" >> >> select substr(t, instr(t, '/sr/db/'), instr(substr(t, instr(t, '/sr/db/'), >> length(t)), chr(10))) from tmp; >> /sr/db/ora/ora.ora >> /sr/db/ora/ora.ora >> where chr(10) ..represents "NEW LINE" in oracle >> >> How do i do the same in mysql. >> >> Thanks for all you help. >> >> regards >> anandkl >> > > > > -- > ----------------------------- > Johnny Withers > 601.209.4985 > johnny@stripped > --000e0cd6b33682d0430471a1596a--