Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: joining tables with SQL::Abstract

by larryl (Monk)
on Nov 19, 2008 at 17:32 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://724659]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-25 19:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found