[Dbix-class] help needed in forming a 'and' and 'or' select query using DBIx::Class

Rajeev Prasad rp.neuli at yahoo.com
Fri Jan 18 18:19:25 GMT 2013


Hello,
=A0
I am trying to build a query based on two column values as folows:
=A0
columnA =3D x=A0 (one char, any char - not null)
columnB =3D zz _or_ x,xx,yyy,mm=A0 (comma seperated values or just one valu=
e)
=A0
=A0
I am looking for rows where: (columnB contains either zz or mm...)
=A0
columnA =3D x AND ( columnB =3D zz OR columnB LIKE '%mm%' )
=A0
=A0
=A0
I am trying following which is not giving correct results.
=A0
=A0
$val =3D 'mm';
=A0
=A0$my_rs =3D $schema->resultset('Mytable')->search({
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0columnA =3D> 'x',
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0columnB =3D> { like =3D> 'zz' },
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0columnB =3D> { like =3D> '%'.$val=
.'%' }
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0});
=A0
=A0
pl advice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20130118/03f=
7c348/attachment.htm


More information about the DBIx-Class mailing list