JOIN from two tables-PDO

I have two tables with fields I want to join.

Table One.

  1. id
  2. article
  3. author

Table Two.

  1. id_from_table_one
  2. path_dir

I want to retrieve the path dir from table two and add it to table 1. The id from table one needs to correspond with the id from table two: that way, I will retrieve the correct image for the query.

Im using PDO and I figured I’d use a join statement, but I can’t seem to make it work.

$query = “SELECT id, article, author FROM Table_One FULL OUTER JOIN Table_two ON folder_path”;

Can someone help me with the correct syntax?

What database server are you using? Not all database servers support the use of full outer joins

SELECT t1.id , t1.article , t1.author , t2.path_dir FROM Table_One AS t1 INNER JOIN Table_two AS t2 ON t2.1.id_from_table_one = t1.id

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.