Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Querying 2 Values Form 1 Column in DBIx::Class

by poj (Abbot)
on Jan 26, 2018 at 19:29 UTC ( [id://1207972]=note: print w/replies, xml ) Need Help??


in reply to Querying 2 Values Form 1 Column in DBIx::Class

See http://search.cpan.org/~ilmari/SQL-Abstract-1.84/lib/SQL/Abstract.pm#Logic_and_nesting_operators

my @results = $schema->resultset( 'People1' )->search({ Name => [ -and => {-like => '%Franklin%'}, {-like => '%Linsey%'}] } );
poj

Replies are listed 'Best First'.
Re^2: Querying 2 Values Form 1 Column in DBIx::Class
by phildeman (Scribe) on Jan 26, 2018 at 21:23 UTC

    Thanks poj,

    That is exactly what I was looking for!

    I finally got it working using the code below, but your way is cleaner and less code!</p

    my $results = $schema->resultset( 'People' )->search({ Name => { like => '%Franklin%' } }, if($results) { $results = $results->search( { Name => {like => '%Linsey%' } } ); } my @result_objs = $results->all;

    Thanks again!

    -Phil-

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1207972]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-18 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found