Click to See Complete Forum and Search --> : sql query as a field?


provkitir
August 4th, 2005, 11:37 AM
hi all,
can one write a sql query as a field?
I'm working on a report on purchases from different vendors
for each purchase, there might be sent thru one or more chunks
for each chunk, the delivered date might vary

My current report lists purchases and its chunks when specified the vendor and the delivered date range, and I can summarize the number of chunks in each purchase fairly easily: DistinctCount(chunk_number, purchase_number)

However, I am having a world of trouble summarizing the number of chunks of several purchases of the same vendor in the specified range of time. Please help. Creating a view in oracle db itself doesn't help because of the specified range of dates, and I was wondering (if i have to) how to create a sql command to do the Sum of DistinctCount of chunks of all purchases for one vendor.

Thanks in advance

provkitir
August 5th, 2005, 07:27 AM
Yay I got it
instead of Sum(DistinctCount(shipment_number, purchase_number), vendor_number), I did:

DistinctCount(totext(shipment_number)&totext(purchase_number), vendor_number), worked like a charm