MySQL Forums
Forum List  »  MySQL Query Browser

SELECT Calculations
Posted by: Kelly Andrew Park
Date: September 27, 2005 09:12AM

Hi, I am having a huge issue with trying to do a calculation within a SELECT Query. I am trying to Add the values of two fields together and then subtract the other two and put them into an AS AvailQty. I am able to output the value after the query, but I CANNOT ORDER BY with that value. Any thoughts? The code is below. Thanks

$getWHSE = mysql_query("SELECT (QtyOnHand + Qty_PO - (Qty_BO + Qty_SO)) AS AvailQty FROM IS_Qty WHERE AvailQty >= 1 ORDER BY AvailQty DESC LIMIT 1");

The above "WHERE AvailQty >= 1" and / or "AvailQty DESC" breaks the query. HELP ME!!!! Thanks, Kelly

Options: ReplyQuote


Subject
Written By
Posted
SELECT Calculations
September 27, 2005 09:12AM
September 27, 2005 11:22AM
September 27, 2005 12:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.