I have two tables and one is parent table and second one is child table both tables has transactions but where as some transactions will take place in parent table and some in child based on their child existence if the parent row doesn't have any child it will be the result and if the parent has the child the child table itself will be the result some times both may occur i tried but not getting the exact solution please help.....
1st table and Parent table
SELECT IFNULL(child.item, parent.item) AS item, IFNULL(child.amount, parent.amount) AS amount, IFNULL(child.tax, parent.tax) AS tax FROM parent LEFT JOIN child ON parent.id = child.p_id
1.4m articles
1.4m replys
5 comments
56.9k users