Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Query problem HELP!!!! Post Reply Post New Topic
Author Message
cyber-guys
Groupie
Groupie


Joined: 02 May 2008
Online Status: Offline
Posts: 42
Quote cyber-guys Replybullet Topic: Query problem HELP!!!!
     Posted: 29 Dec 2009 at 9:53am
I'm having a problem selecting data for a simple report - the SQL table is [PaymentDetails], the 2 fields I'm selecting on are [code] and [type]
 
code is a numerical field (1-4) used for payment type such as cash, check, AP, type is a 1 character string field that is used to indicate if a payment adjustment applies. normally this field is blank, if an adjustment applies it is A
 
I want to select all code equals 3 and type is not equal to 'A' records - when I do, I get no records if I select on just code equals 3 it works for all types, if I select only  type equals A I get all of A types, if I select on type equals '' or not equal to A I get nothing
 
Any idea what I'm doing wrong?  I'm sure it's something simple!
 
Thanks in advance,
Cyber-guys
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Dec 2009 at 10:11am
maybe:
{paymentdetails.code}=4 and
(isnull({paymentdetails.type}) or {paymentdetails.type}<>'A')
 
or make sure you turn the option in the select expert to use "Default Values for Nulls" and you can try:
{paymentdetails.code}=4 and {paymentdetails.type}<>'A'


Edited by DBlank - 29 Dec 2009 at 10:17am
IP IP Logged
cyber-guys
Groupie
Groupie


Joined: 02 May 2008
Online Status: Offline
Posts: 42
Quote cyber-guys Replybullet Posted: 29 Dec 2009 at 10:17am
THANKS!  I knew it had to be something simple.
 
I had already tried {paymentdetails.type}<>'A') with no luck
 
isnull({paymentdetails.type}) is what did the trick!
 
Thanks again,
Cyber-guys
IP IP Logged
cyber-guys
Groupie
Groupie


Joined: 02 May 2008
Online Status: Offline
Posts: 42
Quote cyber-guys Replybullet Posted: 29 Dec 2009 at 2:16pm
Setting the default for nulls probably would have worked also for
type <>'A'
 
Thanks,
Cyber-guys
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