0

I want to replicate this MySQL query in medoo framework in PHP

SELECT col1,col2
FROM table1 t1 
LEFT JOIN table2 t2 
  ON t1.col1 = t2.col4 AND t1.col2=1;

This is what i can come up with

$database->select("table1",[
   "[>]table2"=>["col1"=>"col4","col2"=>1]
],[
   "col1","col2"
]);

But this results in the query

SELECT col1,col2 
FROM table1 
LEFT JOIN table2 
  ON table1.col1=table2.col4 
 AND table1.col2=table2.1 

So is there a way I can escape the default table prefixing by Medoo. I've tried adding a '#' before the column just like in SQL functions but that also didn't work.

Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
firecast
  • 988
  • 2
  • 10
  • 20

1 Answers1

0

Just an idea - what about to use the second condition in WHERE clausule?

Mareg
  • 139
  • 5