November 26th, 2008, 02:22 AM
Using select query in SQL expression fields
My problem is I am not able to insert a field getting data from query. I am using Crystal Report 7.0. I have tried it thru SQL expression fields.
The scenario is, I have 3 tables
itmmast(itemtype, itemsize, make, qtymtr)
grndetails(grnno, itemtype,itemsize,make, qty)
grnmast & grndetails are master-details table.
In itmmast, hierarchy is based on
In my report, I am getting records ordered by itemsize, irrespective of make. I am able to get such records.
Now the problem is I need to insert a field in record that pulls data from grndetails.
The query can be formalized as follows:
select sum(grndetails.qty) from grnmast, grndetails, itmmast where grnmast.grnno=grndetails.grnno and grndetails.itemsize= itmmast.itemsize and grnmast.grndate > mydate;
Now mydate depends on date for financial year 1st April to 31st March.
So if current date lies bet. jan to mar, it financial year is 1st April of previous year and if it is after march then its year will start from 1st April of same year.
I tried using formula fields but din't get correct values.
can anyone help me how I can work it out?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.