Hi *, 

I got 2 statement of query which is related to each other but I am confused
whether I can join them into 1 statement

The first one is:

select A.CustId, max(B.InvoiceNum) as InvoiceNum

from Customer A, CustomerInvoice B

where A.CustId=B.CustId and A.CustStatus='AC' group by A.CustId

 

the results of the query above will be put as $CustId[$a] and
$InvoiceNum[$a] for the following query through a looping process :

select A.CustId, A.CustName, A.CustCompany, A.CustBusName, B.InvoiceNum,
B.CurrentCharge, B.InvoiceStatus, B.UsagePeriod

from Customer A, CustomerInvoice B

where A.CustId=B.CustId  and A.CustId='$CustId[$a]' and
B.InvoiceNum='$InvoiceNum[$a]'

 

Is there a way so I can get the max(B.InvoiceNumber) together with the
record of the Max of InvoiceNum in 1 statement only?

 

Thanks in advance

 

~Elle~

 

 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.642 / Virus Database: 410 - Release Date: 3/24/2004
 

Reply via email to