<div dir="ltr">That should work Alan.</div><div class="gmail_extra"><br><div class="gmail_quote">On 2 December 2014 at 13:26, Alan Lord <span dir="ltr"><<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 02/12/14 07:03, Vikas Jain wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Alan,<br>
<br>
vtiger_notes has document information, if it is related to a internal<br>
file then its filelocationtype is set "I" which means internal. This<br>
document will have a file relation stored in seattachmentsrel table, to<br>
get the actual detail of file like name, path, size etc you need to look<br>
into attachments table. If a Contact/Lead etc is related to a Document<br>
then we store the info into senotes table, so you need to first query<br>
the senotes table to get the related documents then join notes table<br>
with seattachments and attachments table to get the file information.<br>
Let me know if this helps.<br>
</blockquote>
<br></span>
Thanks Vikas,<br>
<br>
I worked it out yesterday in the end ;-) I'm using a query like this:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
SELECT vtiger_attachments.<u></u>attachmentsid AS fileid,<br>
vtiger_attachments.path AS filepath,<br>
<a href="http://vtiger_attachments.name" target="_blank">vtiger_attachments.name</a> AS filename,<br>
vtiger_leaddetails.leadid AS ownerid,<br>
vtiger_crmentity.smownerid AS smownerid<br>
FROM vtiger_attachments<br>
INNER JOIN vtiger_seattachmentsrel<br>
ON vtiger_seattachmentsrel.<u></u>attachmentsid = vtiger_attachments.<u></u>attachmentsid<br>
INNER JOIN vtiger_senotesrel<br>
ON vtiger_senotesrel.notesid = vtiger_seattachmentsrel.crmid<br>
INNER JOIN vtiger_crmentity<br>
ON vtiger_crmentity.crmid = vtiger_senotesrel.crmid<br>
INNER JOIN vtiger_leaddetails<br>
ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid<br>
WHERE vtiger_crmentity.setype = 'Leads'<br>
AND vtiger_crmentity.deleted = 0<br>
AND vtiger_leaddetails.converted = 0<br>
AND <a href="http://vtiger_attachments.name" target="_blank">vtiger_attachments.name</a> LIKE '%grid%'<br>
</blockquote>
<br>
<br>
Al<br>
<br>
<br>
______________________________<u></u>_________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Regards<br>Vikas<br>Vtiger Team</div>
</div>