I have found this code on SQL Union
for item in frappe.db.sql("""select distinct item_code from (
select name as item_code from `tabItem` where ifnull(is_stock_item, 'Yes')='Yes'
union
select distinct item_code from tabBin) a"""):
frappe.msgprint(item[0])
And it is running perfectly, but when I try to replace it with my sql code it always says:
Server Error: Please check your server logs or contact tech support.
My SQL Code:
for product_name,quantity in frappe.db.sql("""select product_name,quantity from (
select product_name,quantity from `tabProduct Details Lane1` where parent='SO00194'
union
select product_name,quantity from `tabProduct Details Lane2` where parent='SO00194') a"""):
frappe.msgprint(product_name[0]+"-"+quantity[0])
Can anyone suggest, what I am missing?
Regards
Ruchin Sharma