Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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


Comment on Re^3: joining tables with SQL::Abstract
Select or Download Code

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 browsing the Monastery: (14)
As of 2014-08-29 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (280 votes), past polls