Re: convert MSSQL Query to Oracle Query

From: Brian E Dick <bdick_at_cox.net>
Date: Wed, 18 Sep 2002 12:50:52 GMT
Message-ID: <ME_h9.68722$8F4.1815156_at_news2.east.cox.net>


Try

select *
from vwnvnxin a
where systemkey = :systemkey
and inspdate =
(select max(inspdate)
from vwnvnxin b
where b.systemkey= a.systemkey)

BTW, this would work with SQL Server, too. It's standard SQL.

"shivas" <shivasbhat_at_rediffmail.com> wrote in message news:346a335.0209180114.3695a877_at_posting.google.com...
> no it cannot be done.It gives an error.
> select * from vwnvnxin where inspdate=max(inspdate)
> *
> ERROR at line 1:
> ORA-00934: group function is not allowed here
>
> thanks
> shivas
>
>
> jocave_at_yahoo.com (Justin Cave) wrote in message
 news:<233b7a65.0209161207.1333a543_at_posting.google.com>...
> > shivasbhat_at_rediffmail.com (shivas) wrote in message
 news:<346a335.0209160554.5e2d0a58_at_posting.google.com>...
> > > I am a trainee programmer doing programming in delphi.
> > > I am getting difficulties in conversion of SQL Query to Oracle
> > > The Query is as follows
> > >
> > > SQL.Add('declare _at_lastinsp datetime');
> > > SQL.Add('select _at_lastinsp=max(inspdate) from vwnvnxin where
> > > systemkey= :systemkey');
> > > SQL.Add('select * from vwnvnxin where inspdate=_at_lastinsp and
> > > systemkey= :systemkey');
> > >
> > > How can I convert the above query to Oracle.
> >
> > Can't you just change this to
> >
> > select * from vwnvnxin where inspdate=max(inspdate) and systemkey=
 systemkey
> >
> > Justin Cave
Received on Wed Sep 18 2002 - 14:50:52 CEST

Original text of this message