Hi Guys,
below is a simple SQL query designed to extract a total from a single table.
What I have been trying to do is take these two sums and add them together giving a result.
Can anyone help me with the correct way to do this, no matter what I have tried I can't seem to get anywhere with it.
I am not sure whether I exctract these two totals then add them together or whether there is a way to change my code to so that it adds up the columns from the two tables then displays a result with both figures added together. The only catch is that it is conditional (ie. SELECT SUM(total) AS total_price1 FROM detail_tourdet WHERE voucher_id = '$voucher_id'"

FYI - voucher ID is a parameter passed from a previous page.
Best Regards
Steve
<?php $sql = "SELECT SUM(total) AS total_price1 FROM detail_tourdet WHERE voucher_id = '$voucher_id'";
$result = mysql_query ( $sql );
$row=mysql_fetch_array($result);
echo $row['total_price1']; ?>
<?php $sql = "SELECT SUM(total) AS total_price2 FROM retail_acom WHERE voucher_id = '$voucher_id'";
$result = mysql_query ( $sql );
$row=mysql_fetch_array($result);
echo $row['total_price2']; ?>