Loading ...
Sorry, an error occurred while loading the content.
 

Re: [phpXperts] Mysql simple query problem

Expand Messages
  • shiplu
    ... [^0-9]+4[^0-9]+|[^0-9]+4$|^4[^0-9]+|^4$ Just Used a regular expression. May be there is better ways. -- A K M Mokaddim http://talk.cmyweb.net
    Message 1 of 4 , Sep 3, 2008

      On Wed, Sep 3, 2008 at 2:35 PM, Tanvir Alam <alam_1674@...> wrote:
      here is the table, with two fields areas and permitted_uid(varchar)

      areas    permitted_uid

      area1    2,3,4
      area2    3,4,11
      area3    5,2,8

      select areas, permitted_uid where permitted_uid rlike '[^0-9]+4[^0-9]+|[^0-9]+4$|^4[^0-9]+|^4$'
      Just Used a regular expression.
      May be there is better ways.

      --
      A K M Mokaddim
      http://talk.cmyweb.net
      http://twitter.com/shiplu
      Stop Top Posting !!
    • Tanvir Alam
      Great, simply helped. you owe me one :) Thanks Tanvir ... permitted_uid(varchar)
      Message 2 of 4 , Sep 3, 2008
        Great, simply helped. you owe me one :)

        Thanks
        Tanvir


        --- In phpexperts@yahoogroups.com, shiplu <shiplu.net@...> wrote:
        >
        > On Wed, Sep 3, 2008 at 2:35 PM, Tanvir Alam <alam_1674@...> wrote:
        >
        > > here is the table, with two fields areas and
        permitted_uid(varchar)
        > >
        > > areas permitted_uid
        > >
        > > area1 2,3,4
        > > area2 3,4,11
        > > area3 5,2,8
        > >
        > > select areas, permitted_uid where permitted_uid rlike
        > '[^0-9]+4[^0-9]+|[^0-9]+4$|^4[^0-9]+|^4$'
        > Just Used a regular expression.
        > May be there is better ways.
        >
        > --
        > A K M Mokaddim
        > http://talk.cmyweb.net
        > http://twitter.com/shiplu
        > Stop Top Posting !!
        >
      • Kristiono Setyadi
        Just use this simple query: SELECT * FROM table WHERE permitted_uid LIKE %,4,% OR permitted_uid LIKE 4,% OR permitted_uid LIKE %,4 Hope it helps.
        Message 3 of 4 , Sep 4, 2008
          Just use this simple query:

          SELECT * FROM table
          WHERE permitted_uid LIKE "%,4,%"
          OR permitted_uid LIKE "4,%"
          OR permitted_uid LIKE "%,4"

          Hope it helps.

           
          Kristiono Setyadi

          Web and .NET Programmer
          CitraWeb Nusa Infomedia
          http://www.citra.web.id

          http://ksetyadi.blogs.friendster.com/


          ----- Original Message ----
          From: Tanvir Alam <alam_1674@...>
          To: phpexperts@yahoogroups.com
          Sent: Wednesday, September 3, 2008 3:35:25 PM
          Subject: [phpXperts] Mysql simple query problem

          here is the table, with two fields areas and permitted_uid( varchar)

          areas permitted_uid

          area1 2,3,4
          area2 3,4,11
          area3 5,2,8

          All I want is , records with permitted uid 4
          So two rows to display in record.

          Please help, if anyone can.

          Thanks
          Tanvir


        Your message has been successfully submitted and would be delivered to recipients shortly.