Subject Re: Sub select with function max problem
Author Svein Erling
I'm sorry, Bayu, but there is little point in sending me your sample
data at kreftregisteret.no. I've looked at your code, and to me both
procedures seem to do the same thing, so I am surprised that the
result differs. You could try sending a little bit of sample data to
setties@..., which I then may be able to have a look at this
evening or tomorrow, even though I do not promise anything. I may not
be able to figure out why testing2 doesn't work, but maybe I can
rewrite it to work.

Though hopefully others will jump in at this list and solve your
problem within a few minutes ;.)

Set

--- In firebird-support@yahoogroups.com, "Bayu" wrote:
> Svein,
>
> Allready change and not work.
> If you don't mind, i will sent sample data to your email address
>
> Thanks
> bayu
> > -----Original Message-----
> > From: Svein Erling [mailto:svein.erling.tysvaer@k...]
> > Sent: Friday, February 20, 2004 3:52 PM
> > To: firebird-support@yahoogroups.com
> > Subject: [firebird-support] Re: Sub select with function max
> > problem
> >
> >
> > Use aliases EVERYWHERE. I.e. change to
> >
> > Select d.deptid, d.deptcode, d.deptname, d.deptno
> > from deptsections d
> > where d.deptid = (
> > Select first 1 a1.deptid
> > from atdhistory_temp a1
> > where a1.empid = :empid_2
> > and a1.workdate = (
> > Select max( a2.workdate )
> > from atdhistory_temp a2
> > where a2.workdate between :mulai and :mulai
> > + 6
> > and a2.empid = :empid_2
> > )
> > )
> > into :deptid_2, :deptcode_2, :deptname_2, :deptno_2;
> >
> > I don't know whether this is your problem or not, but it is a good
> > habit to use aliases and without them I never know how Firebird
> > reads my query. Report back if this solves your problem, or if we
> > have to look closer at your code.