SQL क्वेरी में IF कंडीशन जोड़ें, कुछ इस तरह।
SELECT invoice_details.invoice_no,
invoice_details.invoice_date,
invoice_details.invoice_amount,
SUM(IF(received_amount_details.received_amount IS NULL
OR received_amount_details.received_amount = '', 0.0,
received_amount_details.received_amount)) AS totalreceiptamt
FROM (SELECT DISTINCT invoice_no,
received_amount
FROM received_amount_details) AS received_amount_details
right join invoice_details
ON received_amount_details.invoice_no =
invoice_details.invoice_no
WHERE invoice_details.proje_id = '7'
GROUP BY invoice_details.invoice_no
यह 0.0 जोड़ देगा क्योंकि डिफ़ॉल्ट मान प्राप्त नहीं हुआ है_amount_details.received_amount IS NULL या रिक्त है
साथ ही हम इनवॉइस_विवरण पृष्ठ से सभी मान प्राप्त करने के लिए राइट जॉइन कर रहे हैं।
आप यहाँ MYSQL में IF स्थिति के बारे में अधिक जान सकते हैं,
https://www.w3schools.com/mysql/func_mysql_if.asp https://dev.mysql.com/doc/refman/8.0 /hi/if.html