If I understood you correctly, you want something like this.
"SELECT
msdnd_oct.id as id1,
msakl_oct.id as id2,
msdnd_oct.sold as sold1,
msakl_oct.sold as sold2,
msdnd_oct.sales as sales1,
msakl_oct.sales as sales2
FROM msdnd_oct inner join msakl_oct ON msakl_oct.id=msdnd_oct.id"
If you want to compare total sales, or sold items you can use GROUP BY
Or If you simply want to combine to tables without joining them you can use UNION
You can execute above query in php as below
$query = "SELECT
msdnd_oct.id as id1,
msakl_oct.id as id2,
msdnd_oct.sold as sold1,
msakl_oct.sold as sold2,
msdnd_oct.sales as sales1,
msakl_oct.sales as sales2
FROM msdnd_oct inner join msakl_oct ON msakl_oct.id=msdnd_oct.id";
$result = mysqli_query($dbhandle,$query);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id1: " . $row["id"]. " - id2: " . $row["id2"]. " <br>";
}
} else {
echo "0 results";
}
$conn->close();
I encourage you learn much more about connecting to Mysql, retrieving data from Mysql with PHP. Take a look at below links. Then you will get the clear idea of how to do your given task.
1
solved How Can I compare two tables?