Sunday, January 10, 2010

Get all vtigerCRM Leads

This query get all leads in vtigerCRM

SELECT t1.lead_no AS 'Lead No'
, t1.lastname AS 'Last Name'
, t1.firstname AS 'First Name'
, t1.company AS 'Company'
, t4.phone AS 'Phone'
, t5.website AS 'Website'
, t1.email AS 'Email'
, t3.user_name AS 'Assigned To'
FROM vtiger_leaddetails t1
INNER JOIN vtiger_crmentity t2 ON t1.leadid = t2.crmid AND t2.setype = 'Leads'
INNER JOIN vtiger_users t3 ON t2.smownerid = t3.id
LEFT JOIN vtiger_leadaddress t4 ON t1.leadid = t4.leadaddressid
LEFT JOIN vtiger_leadsubdetails t5 ON t1.leadid = t5.leadsubscriptionid

No comments:

Post a Comment