2012-09-28 10:23:27 +05:30

28 lines
751 B
SQL

SELECT
`tabCustomer`.name,
`tabCustomer`.customer_name,
`tabAddress`.address_line1,
`tabAddress`.address_line2,
`tabAddress`.city,
`tabAddress`.state,
`tabAddress`.pincode,
`tabAddress`.country,
`tabContact`.first_name,
`tabContact`.last_name,
`tabContact`.phone,
`tabContact`.mobile_no,
`tabContact`.email_id
FROM
`tabCustomer`
left join `tabAddress` on (
`tabAddress`.customer=`tabCustomer`.name and
ifnull(`tabAddress`.is_primary_address, 0)=1
)
left join `tabContact` on (
`tabContact`.customer=`tabCustomer`.name and
ifnull(`tabContact`.is_primary_contact, 0)=1
)
WHERE
`tabCustomer`.docstatus<2
ORDER BY
`tabCustomer`.customer_name asc