I've a requirement to perform a join operation in SQL with two foreign keys on same table. The answer in below post has the SQL for my requirement.
Join On Two Foreign Keys From Same Table In Sql
I am trying to convert this query into Medoo syntax, but I don't get the desired output. Code posted below is my latest effort which doesn't work.
$db -> select( "item_tbl", [ "[>]user_tbl.id" => ["ownerId", "lastModifiedById"] ], ["username", "username", "itemName"]);
Could somebody please help?
I've framed the Medoo Syntax myself using aliases. Below is the Medoo equivalent code for above SQL:
$db->select("item_tbl",["[><]user_tbl(user_tbl_a)" => ["item_tbl.ownerId" => "id"],"[><]user_tbl(user_tbl_b)" => ["item_tbl.lastModifiedById" => "id"]],["user_tbl_a.username(Owner)","user_tbl_b.username(Modifier)","itemName"]);