Created
January 27, 2014 05:00
-
-
Save oshanz/8643495 to your computer and use it in GitHub Desktop.
mysql variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$query = "SELECT * , | |
@amount:=(SELECT SUM((`ghi_qty`*`g_price`)) FROM `tbl_grn_has_item` ghi WHERE ghi.`idgrn`= grn.`idgrn`) AS amount, | |
(@amount-(@amount*(grn.g_discount/100))) AS `grandtotal`, | |
(@amount*(grn.g_discount/100)) AS `discount` | |
FROM `tbl_grn` grn | |
INNER JOIN `tbl_delivery_note` dn ON grn.`iddelivery_note`= dn.`iddelivery_note` | |
INNER JOIN `tbl_purchase_order` po ON dn.`idpurchase_order`= po.`idpurchase_order` | |
INNER JOIN `tbl_user` tu ON po.`idposition`=tu.`iduser` WHERE grn.`g_status`='0' aND po.`idposition`='{$user_id}'{$querypart}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment