Mysql full join error- # 1054 - Unknown column "feemaster.PAIDAMOUNT" in "field list"
I have a query that returns data like this
DATE( expensemaster.`date` ) SUM( feesmaster.PAIDAMOUNT ) SUM( expensemaster.amount )
2013-01-09 0 7824.4
2013-01-15 200 211
view the request,
SELECT DATE( expensemaster.`date` ) ,
SUM( feesmaster.PAIDAMOUNT ) ,
SUM( expensemaster.amount )
FROM
feesmaster
INNER JOIN expensemaster
ON DATE( feesmaster.DATETIME ) = DATE( expensemaster.date )
WHERE
DATE( expensemaster.`date` ) BETWEEN '2013-01-09' AND '2013-01-15'
AND DATE( feesmaster.`datetime` ) BETWEEN '2013-01-09' AND '2013-01-15'
GROUP BY
DATE( feesmaster.`datetime` ),
DATE( expensemaster.`date` )
If I replace the inner one with a full one, so I can get the Return rows when there is a match in one of the tables, but I get the error
# 1054 - Unknown column "feemaster.PAIDAMOUNT" in the "field list"
I am using phpmyadmin.
source to share
As I know MySQL does not support FULL JOIN
, so the word FULL
in this case means ALIAS for your first table feesmaster
. So there is no column feesmaster.PAIDAMOUNT
, but FULL.PAIDAMOUNT
. You can implement FULL JOIN UNION LEFT JOIN and RIGHT JOIN
UPD: Also in your case FULL JOIN (and LEFT / RIGHT JOIN as well) doesn't make sense for this query as soon as your WHERE is set to TRUE only if expensemaster.date
and feesmaster.datetime
NULL
. So in this case only works INNER JOIN
.
source to share