Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: joining tables with SQL::Abstract

by larryl (Scribe)
on Nov 19, 2008 at 17:32 UTC ( #724659=note: print w/replies, xml ) Need Help??


in reply to Re^2: joining tables with SQL::Abstract
in thread joining tables with SQL::Abstract

It's pretty easy in SQL::Abstract to force an AND situation when you have two (or more) conditions on the same column, just use an arrayref where the first element is '-and'. E.g.:

{ create_date => [-and => {'>=' => $start_date}, {'<=' => $end_date}] }

which produces:

WHERE ( ( ( create_date >= ? ) AND ( create_date <= ? ) ) )

For your case you would use:

{ 'users.userid' => [-and => {'=' => 1000}, \'= drivers.userid'] }

which produces:

WHERE ( ( ( users.userid = ? ) AND ( users.userid = drivers.userid ) + ) )


HTH, Larry

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2016-10-01 20:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (7 votes). Check out past polls.