<DIV>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 ?>
<TBODY>
<TR>
<TD>
<DIV>
<DIV>Hi</DIV>
<DIV>I have two tables OrderDetails and TransDetails. </DIV>
<DIV>&nbsp;</DIV>
<DIV>The orderLine field in OrderDetails is in&nbsp;100, 200,&nbsp;300 ...(in Hundreds) if the order type is '111', and 1000,2000,3000&nbsp;...(in Thousands) if the type is '222'. </DIV>
<DIV>&nbsp;</DIV>
<DIV>But in TransDetails file there is only orderlineNo field with 1, 2, 3.&nbsp; To get uniquely matched transReason data, I need to make conversion on orderLine&nbsp;field by dividing 100 or 1000 depending on orderType.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I try to use Select statement like below, but it won't work.</DIV>
<DIV>&nbsp;</DIV>
<DIV>SELECT&nbsp; A.warehouseNo, A.itemNo, A.plannedDate, A.orderNo, A.orderLine, A.orderType, A.status, A.orderQty, B.transReason&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>FROM&nbsp;&nbsp;&nbsp;&nbsp;OrderDeatails &nbsp;AS A, TransDetail&nbsp;AS B</DIV>
<DIV>&nbsp;</DIV>
<DIV>WHERE</DIV>
<DIV>&nbsp;</DIV>
<DIV>(&nbsp;if (A.orderType = '111') A.orderLine/100 = B.orderLineNo<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else&nbsp; if (A.orderType&nbsp; = '222') A.orderLine/1000 = B.orderLineNumber</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND&nbsp;A.itemNo=B.itemNo<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND&nbsp;A.orderNumber=B.orderNumber</DIV>
<DIV>&nbsp;)<BR></DIV>
<DIV>AND &nbsp;trim(A.warehouseNo)=trim(&lt;dtml-sqlvar whouse type=string&gt;)<BR>AND&nbsp; trim(A.itemNo) = trim(&lt;dtml-sqlvar item type=string&gt;)<BR></DIV>
<DIV>ORDER BY plannedDate,itemNo</DIV>
<DIV>&nbsp;</DIV>
<DIV>Is there anyone who can help me to sort out.<BR></DIV></DIV></TD></TR></TBODY></TABLE></DIV></DIV><p>
                <hr size=1><font face=arial size=-1>Do you Yahoo!?<br>Yahoo! Movies - <a href="http://movies.yahoo.com/showtimes/movie?mid=1808405861">Buy advance tickets for 'Shrek 2' </a>