Welcome Guest, Not a member yet? Register   Sign In
INNER JOIN USING
#1

I have this in my normal query  :

INNER JOIN vehicles USING(idvehicles)

but  in active record using this :

$builder->join('vehicles', 'e.idvehicles = vehicles.idvehicles');

does not return the same results.
Reading the builder class there is a $type  in the join method but I dont think it has
nothing to do with my case.
Does that mean I have to use a raw query to get my results ? If yes this why there is
prepare and execute in running queries I read in documentation ?

I'm very new to all this pls  pardon my ignorance
Reply
#2
Smile 

Well to answer my own question  in case some other newbie falls into the same pit
I had to alter the statement  from
$builder->join('vehicles', 'e.idvehicles = vehicles.idvehicles');
to
$builder->join('vehicles', 'idvehicles', 'INNER');

also if your query returns more that one row you need to use wherein instead of  where
($builder->wherein instead of $builder->where)

I had to read the BaseBuilder.php  in order to get the info , the documentation is a bit
vague in this .

Thanks for a great tool though . If you need help with documentation  I would be willing to
help you folks.
Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB