我只想显示大于0.00的总数,但是不显示大于0.00的所有数字。
下面是我的查询:
SELECT t2.mall AS mall,
t3.company AS compname,
t1.title AS tradename,
t1.reference_no AS ReferenceNo,
DATEDIFF(COALESCE(NULL, payment, DATE_FORMAT(NOW(),'%Y-%m-%d')),DATE_FORMAT(NOW(),'%Y-%m-%d')) AS DaysDue,
t1.createdByName AS marketingPIC,
@v1:=CAST(FLOOR(COALESCE(NULL, total_rental, '0.00')+COALESCE(NULL, security_deposit, '0.00'))AS DECIMAL(6,2)) AS TotalPayable,
COALESCE(NULL, payment_total, '0.00') AS TotalPaid,
@vx:=CAST(FLOOR(COALESCE(NULL, payment_total, '0.00'))AS DECIMAL(6,2)),
@out:=CAST(@v1-@vx AS DECIMAL(6,2))AS TotalOutstanding, t4.start_date AS startdate,
t4.end_date AS enddate
FROM table1 t1
INNER JOIN table1 t2
ON t2.id=t1.mall_id
INNER JOIN table3 t3
ON t3.id=t1.company_name_id
INNER JOIN table4 t4
ON t4.parent_id=t1.id
@out:=CAST(@v1-@vx AS DECIMAL(6,2)) <> 0.00