PHP / SQL - 多表搜索

Hey guys i am looking for some way to search in multiple database table without using UNION. My code is pretty simple, its something like:

$con = new PDO( DB_HOST, DB_USER, DB_PASS ); 
    $con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
    $sql1 = "SELECT * FROM evidence_vin WHERE vin = :vin LIMIT 1";
    $sql2 = "SELECT * FROM national_register_sk WHERE vin = :vin LIMIT 1";
    $sql = $sql1 . ' UNION ' . $sql2;

    $stmt = $con->prepare( $sql ) union ( $sql2 );
    $stmt->bindValue( "vin", $this->vin, PDO::PARAM_STR );
    $stmt->execute();
        echo "<table>";
        echo "<th>Progress</th>";
        echo "<th>Claim number</th>";
        echo "<th>Make</th>";
        echo "<th>Status</th>";
        echo "<th>View</th>";
        echo "<th>Action</th>";
        while ($row = $stmt->fetch()){
            echo "<tr>";
            echo "<td>24</td>";
            echo "<td>".$row['claim_number']."</td>";
            echo "<td>".$row['license']."</td>";
            echo "<td>".$row['country']."</td>";
            echo "<td>".$row['vin']."</td>";
            echo "<td><a href=\"detail.php?id=".$row["id"]."&action=detail\">detail</td>";
            echo "</tr>";
             } 
        }catch(PDOExeption $e){
        echo $e->getMessage();

I have some problems with this because i will need some specific data from table one and some specific from table 2 and i am not sure which one i will need yet. So i need some way to get a line from each table where VIN is $this->vin. (vin is in both tables same)

p.s. Tables dont have same number of colums

Have a look at JOINS: http://www.sitepoint.com/understanding-sql-joins-mysql-database/

If i understand your problem correctly that should solve it.

If You want to get different columns from those tables, just make two queries. Seems like only way. Also if You want all ingo on one VIN in one line , than use JOINS , but than You need to be sure that format of those VIN columns is the same.

@Martin , as for multiple queries: http://php.net/manual/en/mysqli.quickstart.multiple-statement.php,

I know its mysqli but its only one I found - its very bad practice.

But in Your place I would do something like that:

SELECT * FROM evidence_vin ev LEFT OUTER JOIN national_register_sk nrs ON ev.vin = nrs.vin where ev.vin = :vin LIMIT 1

But remember that if VIN will not be present in first table and will be in second You won't get results.