Solved

Crystal Report

Posted on 2014-07-26
3
482 Views
Last Modified: 2014-08-03
I have table that 5 columns
ID   Name    Account1    Account2 Account3 Account4
19   John       212                444            325           0
22   Chris      333                212            213         234
15   Steve     212                458             235         213
12    Jim        324                876            123          212.

I would like to retrieve all the data that have "212" Account#. It could be in any column.

What SQL Statement I can use to get this data?
0
Comment
Question by:snhandle
3 Comments
 
LVL 48

Accepted Solution

by:
PortletPaul earned 250 total points
ID: 40222204
If an account number is a string then use '212' if it is an integer just use 212
SELECT
      ID
    , Name
    , Account1
    , Account2
    , Account3
    , Account4
FROM ThatTable
WHERE (  Account1 = '212'
      OR Account2 = '212'
      OR Account3 = '212'
      OR Account4 = '212'
      )

Open in new window

0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 250 total points
ID: 40224103
The above comment will work if you are creating the view in the database or using a COMMAND as the data source.

If you are doing this in Crystal you only need to have the WHERE part in the SELECT EXPERT.

{YourTable.Account1} = "212"
OR
{YourTable.Account2} = "212"
OR
{YourTable.Account3} = "212"
OR
{YourTable.Account4} = "212"


If the field is numeric remove the " " around the 212

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 40226615
Just for the heck of it, this is a slightly different way to do the same thing:

"212" in [ {table.Account1}, {table.Account2}, {table.Account3}, {table.Account4} ]


 It's not really any better.  Just different.  Maybe a little "simpler".

 James
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now