What is the correct syntax for the WHERE clause in a MySQLi SELECT statement when using JOINs?

When using JOINs in a MySQLi SELECT statement, the WHERE clause should specify the conditions for filtering the result set based on columns from the joined tables. To reference columns from the joined tables in the WHERE clause, you need to prefix the column name with the table alias or table name. This helps MySQL to understand which table's column you are referring to. Example:

<?php
// Establish a MySQLi connection

$query = "SELECT column1, column2 FROM table1 
          JOIN table2 ON table1.id = table2.table1_id 
          WHERE table1.column3 = 'value' AND table2.column4 = 'value2'";

$result = $conn->query($query);

// Process the result set
?>