Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Return Top 4 Post Reply Post New Topic
Author Message
NicholasP
Newbie
Newbie


Joined: 06 Feb 2008
Online Status: Offline
Posts: 3
Quote NicholasP Replybullet Topic: Return Top 4
     Posted: 06 Feb 2008 at 12:14pm
I'm trying to pull the last 4 records from an Oracle database and the SQL code isn't quite working.... the error I'm getting says the From keyword is not found where expected....

Any help would be greatly appreciated.

Thanks
Nick

Select p.sAddr1 name TOP 4
, p.sCode propcode
, attributes.SUBGROUP2 proptype
, attributes.SUBGROUP1 advisor
, attributes.SUBGROUP13 status
, ASCAP15.dtDate dt
, ASCAP15.A_AFTOTALRETURN af_totret
, ASCAP15.A_AFINCOMERETURN af_incret
, ASCAP15.A_AFAPPRECRETURN af_appret
From  Property p , Attributes , ASCAP15
Where      p.hMy = attributes.hProp and  p.hMy = ASCAP15.hProp (+)  and attributes.SUBGROUP2<> ' ' and attributes.SUBGROUP13<> 'Proposed Purch'
ORDER BY p.sAddr1 DESC, ASCAP15.dtDate ASC
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 07 Feb 2008 at 4:58am
Er, actually, it's your "TOP 4" phrase that's in the wrong place.  It should come immediately after SELECT.

I also find your lack of JOIN disturbing.  Not wrong, necessarily, but disturbing.  I generally find that this kind of implicit JOIN is very error-prone.
IP IP Logged
NicholasP
Newbie
Newbie


Joined: 06 Feb 2008
Online Status: Offline
Posts: 3
Quote NicholasP Replybullet Posted: 07 Feb 2008 at 3:13pm
Thanks for the pointer...I actually find it disturbing that I've been roped into doing this kind of stuff....oh well.

Thanks Again
Nick
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum