i am bit confuse in to getting the result into the two tables, i know it is simple but not getting any clue..
here is my query the gives me the result, but when i am using the group by then it’s just giving me the result of one line even the actual result in database is (300, 500) because i am fetching the result through the lead_id which is common in both tables..
SELECT inv.amount, crmd.computers, crmd.product_id, crmd.pc_opti
FROM invoice AS inv, lead_crm_data AS crmd
WHERE inv.lead_id = '310'
AND crmd.lead_id = '310'
GROUP BY inv.lead_id
here is the result of the given query..
amount computers product_id pc_opti
300 2 7, 6 2
300 3 7, 6 3
540 2 7, 6 2
540 3 7, 6 3
result with GROUP BY
300 2 7, 6 2
Desired REsult
300 2 7, 6 2
540 3 7, 6 3
Try this:
You could use a better (IMHO) syntax: