whats wrong with this...

Results 1 to 2 of 2

Thread: whats wrong with this...

  1. #1
    Join Date
    Dec 1969

    Default whats wrong with this...

    Hi all,<BR><BR>whats wrong with this union query<BR><BR>select sum(p.Amount + i.amt) as amountVal from PaymentReceivedDetails p, invoiceMaster i where p.fileno=i.fileno and p.paymentdate=datevalue(&#039;13/sep/2004&#039;) and p.fileNo = 2 <BR><BR>Well the result I am getting is not correct, its totalling the complete 2 tables which is wrong.<BR><BR>Thanks all.<BR>

  2. #2
    Join Date
    Dec 1969

    Default For starters...

    ...that is *NOT* a UNION query. You don&#039;t have the word UNION in there anywhere.<BR><BR>That&#039;s a simple inner join query.<BR><BR>Why are you using DATEVALUE there???? Why not just #2004-9-13# or something similar?<BR><BR>Anyway, to see what is happening, try running the query in Access itself, instead of in ASP.<BR><BR>And try running it without using SUM, perhaps like this:<BR><BR>select p.Amount, i.amt<BR>from PaymentReceivedDetails p, invoiceMaster i <BR>where p.fileno=i.fileno <BR>and p.paymentdate = #2004-9-13#<BR>and p.fileNo = 2 <BR><BR>See if you are even *getting* the values you expect. I strongly suspect the answer is going to be no.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts