Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Join Issue? (Crystal Reports)

Author  Topic 

blandow
Starting Member

6 Posts

Posted - 2011-04-25 : 10:41:36
I have 2 tables. They Both contain a field called "cust#"

If the cust# field on one table matches the other, I return the results in a new column with string "DI". If they dont match, the string should return "COPS". I have written the following formulas:
-------------------------------------------------------
StringVar RE;
If {dist_customer_billing_profiles.customer_no} <> {customers.customer_no} Then RE := "COPS"
Else RE := "DI"
--------------------------------------------------------

Problem is that everything shows up as "DI", no matter if the criteria
is met or is not met. I've tried several joins, but still do not get what I need.

Thanks in advance for any help...

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2011-04-26 : 05:22:31
IN SQL language it can be used as -
CASE WHEN {dist_customer_billing_profiles.customer_no} <> {customers.customer_no} Then 'COPS' Else 'DI' END AS RE

Vaibhav T

If I cant go back, I want to go fast...
Go to Top of Page
   

- Advertisement -