Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with sql statement

Status
Not open for further replies.

muffntuf

MIS
Jan 7, 2003
155
US
Does anyone know of a better way to write this sql statement? It seems that I need to exclude the and not like portion, but I don't think this is getting excluded from results.

'OTHERCONDIS' = CASE WHEN GLT_Dist.Acct_Nbr LIKE '01-4%' OR GLT_Dist.Acct_Nbr LIKE '02-4%'
OR GLT_Dist.Acct_Nbr NOT LIKE '01-4___-13-00-%' OR GLT_Dist.Acct_Nbr LIKE '02-4___-13-00-%'
OR GLT_Dist.Acct_Nbr LIKE '01-4___-17-00-%' OR GLT_Dist.Acct_Nbr LIKE '02-4___-17-00-%' THEN (isnull((Cr_Amt),0)- isnull((Db_Amt),0))END

Thanks,
muffntuf
 
I'd do it as several Crystal formulas, things like
Code:
GLT_Dist.Acct_Nbr LIKE '01-4%'
This would come out as a boolian, true or false and you could display it to check it was coming out OK. You could then combine it with the other tests in another formula field. If the boolian were @Acc_1_4 then you could just say @Acc_1_4 or not @Acc_1_4

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top