Solved

Crystal Report

Posted on 2014-07-26
3
491 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

813 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