Hi i currently used a script tutorial that used UNION to add up the order ammount before sending to PayPal. I recently uploaded my script to the server and have realised that the sql version used does not support UNION. I replaced my script using 2 sql statements but when it linked to PayPal the order ammount was 0. Below is my script. Can anyone tell me what I can use to replace Union to make it compatible with an older version of SQL?
$sql = "SELECT SUM(pd_price * od_qty) FROM tbl_order_item oi, tbl_product p WHERE oi.pd_id = p.pd_id and oi.od_id = $orderId UNION SELECT od_shipping_cost FROM tbl_order WHERE od_id = $orderId"; $result = dbQuery($sql);
any help will be great.
Thx
I dont understand your statements.
The union operator doesn't sum up the rows. So you get always 2 rows back.
The DB you are using must be very old...
Try something like that:
select b+c from a, (select sum(b) c from a);
B+C
2
kind regards,