?
Solved

Crystal Report

Posted on 2014-07-26
3
Medium Priority
?
500 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 49

Accepted Solution

by:
PortletPaul earned 1000 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 101

Assisted Solution

by:mlmcc
mlmcc earned 1000 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 35

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

718 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