Hi David,<br><br>I would suggest to take a 2 tier approach<br><br>* SELECT customers.cid FROM customers<br><br>* For each of the customers get the last order details<br><br>SELECT orders.oid, customers.email FROM orders INNER JOIN customers on customers.cid = orders.cid ORDER BY orders.orderdate DESC LIMIT 1<br>
<br>Regards,<br>Prasad<br>vtiger Team<br><br><div><span class="gmail_quote">On 2/14/09, <b class="gmail_sendername">David fire</b> &lt;<a href="mailto:ddfire@gmail.com">ddfire@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
hi<br>this is an off topic sorry.<br><br>i have 3 tables <br><br>orders:<br>oid,cid,orderdate<br><br>customers:<br>cid,email,name<br><br>splits:<br>oid,quantity,ordprodisize<br clear="all"><br>cid= uctomer id.<br>oid= order id.<br>

<br>i need to pick the last order of each customer before a date for example 2008-10-01 <br>and the emal and the quantity,<br><br>please help.<br><br><br>&nbsp;<br>if you help me i will be abel to finish to modules for vtiger.<br>

a web soft phone.<br>and a module creator, yes a module to make new modules nice ;-)<br><br>David<br><span class="sg"><br><br>-- <br> (\__/) <br>(=&#39;.&#39;=)This is Bunny. Copy and paste bunny into your <br>(&quot;)_(&quot;)signature to help him gain world domination. <br>

<br>
</span><br>_______________________________________________<br>
Reach hundreds of potential candidates - <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://jobs.vtiger.com" target="_blank">http://jobs.vtiger.com</a> <br></blockquote></div><br>