cancel
Showing results for 
Search instead for 
Did you mean: 

Need to compare values of two columns in one table in Crystal Report

former_member603482
Discoverer
0 Kudos

I need help with this, hope someone can help. Thanks ahead of time.

I have two fields. CollumnA and CollumnB

I want to compare the values of column A with all the values of column B and remove all duplicate values from both columns with their rows.

**columnA ... columnB**

POD001 ... DPR001

POD002 ... DPR002

POD003 ... POD002

POD004 ... POD003

**OUTPUT SHOULD LOOK LIKE THIS:**

column A column B

- POD001 ... DPR001

Thanks for any help.

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

Are you just joining tables together in Crystal or are you connecting to a stored procedure or a command?

A command is a SQL select statement that pulls ALL of the data for a report using the SQL syntax of the database that you're connecting to. Here is more information about how to use commands: https://blogs.sap.com/2015/04/01/best-practices-when-using-commands-with-crystal-reports/.

If you're not sure how to write the query for this, you can go to Database >> Show SQL Query in Crystal, copy the query that Crystal generated and paste it in a comment here along with information about what type of database you're connecting to and which fields are column A and column B. With that information I will probably be able to write it for you.

-Dell

Answers (1)

Answers (1)

former_member603482
Discoverer
0 Kudos

Hi Dell

Thank you for your answer..

I'm connecting my crystal report to the Sql server. I created a Shared array + formula based on column B in sub_report and then linked it with the main report and suppress column A but this logic didn't work. I may try inner join query in sql but the problem is columnA ... columnB are both from one table.

There is another problem which column A is a formula based on join from two column in one table.

Do you think can I write custom query only on one table?

DellSC
Active Contributor
0 Kudos

It depends on what you're trying to do with that one table....

Are you trying to compare values in the same row of the table or are you trying to compare a value from column A from one row with the values of column B in other rows? What's the logic for what you're trying to do?

-Dell