SELECT v.accountid, v.salutation,
v.firstname, v.lastname, v.email, v.phone, v.mobile,
v.title, v.department, v.fax, v.reportsto, v.training,
 v.usertype, v.contacttype, v.otheremail, v.yahooid, v.donotcall,
 v.emailoptout,  v.imagename, v.reference, v.notify_owner
,x.contactaddressid, x.mailingcity, x.mailingstreet,
x.mailingcountry, x.othercountry, x.mailingstate, x.mailingpobox, x.othercity,
x.otherstate, x.mailingzip, x.otherzip, x.otherstreet, x.otherpobox FROM
vtiger_contactdetails v join vtiger_contactaddress x on (v.contactid = x.contactaddressid)
join vtiger_contactscf y on (v.contactid = y.contactid)