After trying quite a few variations to join data between tables when selecting via DBUtil::, having trouble with various mysql errors. If there are 2 tables setup like this:
TABLE1: [uid] [name] [race]
TABLE2: [rid] [laps] [time [20]] [height] [weight]
How to select from above tables into an array like below, in one query, given the $id to select from TABLE1?
data (
uid => 23,
name => 'John Q. Public',
race => '1 Mile',
stats => array [21](laps => 'value',
time [22] => 'value',
height => 'value',
weight => 'value')
)
The
$data['stats'] variable would be made on the fly presumably, and essentially consist of the same data that would result from "
SELECT * FROM TABLE2 WHERE rid='$uid'". This
is a situation where leftjoin should be used, right?
I've looked over the selectObject* and selectExpandedObject* functions and have read the $joinInfo info at the top of the class, but can't get the syntax right...
Any assistance is appreciated!
Thanks,
- John
--
Photography [23] |
PHP [24] |
Other [25]