<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4712.0">
<TITLE>Query synatx</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Dear List</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I have a OrderHeader and OrderDetails tables. </FONT>
<BR><FONT SIZE=2 FACE="Arial">The OrderHeader contains a InvoiceType field, set to True for Invoice and False for CreditNotes.</FONT>
<BR><FONT SIZE=2 FACE="Arial">The OrderDetails contains a Quantity field. This is always a positive value, even for CreditNotes.</FONT>
<BR><FONT SIZE=2 FACE="Arial">The join between the tables is on OrderID.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">What I am trying to do is create a query that will return a single value for all the quantities on order in the OrderDetails, for a given product number. So where the InvoiceType = False, the Quantity will have to be Quantity * -1.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">This has got to be possible, but having spent most of the day going nowhere with this, I need help.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Any ideas would be much appreciated.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Many thanks</FONT>
<BR><B><I><FONT COLOR="#000080" FACE="Times New Roman">Tim Pain</FONT></I></B>
</P>
<BR>
<BR>
</BODY>
</HTML>