Home » SQL & PL/SQL » SQL & PL/SQL » group function in where clause
group function in where clause [message #4299] Mon, 25 November 2002 15:20 Go to next message
sfhollands
Messages: 15
Registered: October 2001
Junior Member
My problem is this. I want to retrieve all the records based on the final payment date selected by user.
there are 2 tables master-detail on for the transaction details and the other for the payment details. so a transaction can have one or more payment records. Based on the fina payment month and year the earlier records(which may fall on to different months must also be retrieved)

eg trxn no - 100
payment dt - 09/20/02, 10/5/02, 10/30/02
payment amounts - 50, 60, 75

when the user enters the final payment month - 10 and year '02
the report must retrieve a total of 50+60+75 = 185

so waant where max(to_char(pay_date,'mm')=10 and max(to_char(pay_date,'yyyy')='2002'
which i am not able to use
Hope i am clear

all help appreciated.

Thanks,
Re: group function in where clause [message #4301 is a reply to message #4299] Mon, 25 November 2002 16:11 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
This sounds like just:

where payment_dt <= :final_payment_date


If your requirement is different, you would have to provide more sample data and the desired result set, but this doesn't look like a grouping problem at all.
Previous Topic: SQLCode
Next Topic: Union ALL
Goto Forum:
  


Current Time: Mon Apr 29 18:07:26 CDT 2024