vendredi 14 novembre 2014

Select MySQL Month() for null column


Vote count:

0




Got a question to ask. How do i get to list all of my left table to display the data when i use the left join even when some row got null value in it?


Heres my query:



SELECT *, SUM(transactions.debit_credit) current_spending
FROM (`budget`) LEFT JOIN `categories` ON `budget`.`category`=`categories`.`idcategory`
LEFT JOIN `user_category` ON `budget`.`category`=`user_category`.`idcategory`
LEFT JOIN `category_transaction` ON `budget`.`category`=`category_transaction`.`idcategory`
LEFT JOIN `transactions` ON `category_transaction`.`idtransaction`=`transactions`.`idtransaction`
WHERE `user_category`.`iduser` = '1'
AND MONTH(transactions.transaction_date) = '11'
GROUP BY `budget`.`idbudget`;


When I remove AND MONTH(transactions.transaction_date) = '11' the query works fine accept it displays all data instead of just 1 month of transaction.


Help?? Please?? Any idea how??



asked 1 min ago







Select MySQL Month() for null column

Aucun commentaire:

Enregistrer un commentaire